/* ==========================================================================
   MASI GIOIELLI ERP - MODERN STYLESHEET (VANILLA CSS & RICH AESTHETICS)
   ========================================================================== */

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #38bdf8;

    --primary: #0284c7;
    --primary-hover: #0369a1;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border-color: #e2e8f0;
    --radius: 10px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- LOGIN PAGE --- */
.login-body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0369a1 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin: 0 auto 16px;
    box-shadow: 0 8px 16px rgba(217, 119, 6, 0.3);
}

.login-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.login-header p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.login-error {
    background-color: #fef2f2;
    border: 1px solid #fca5a5;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* --- APP LAYOUT & SIDEBAR --- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: all 0.3s ease;
}

.brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.brand-text h1 {
    font-size: 15px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
}

.brand-text span {
    font-size: 11px;
    color: #64748b;
}

.nav-menu {
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background-color: var(--sidebar-hover);
    color: white;
}

.nav-item.active {
    background-color: rgba(56, 189, 248, 0.15);
    color: var(--sidebar-active);
    font-weight: 600;
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tenant-badge {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- MAIN CONTENT & TOPBAR --- */
.main-content {
    margin-left: 260px;
    flex: 1;
    min-width: 0;
    padding: 24px;
    max-width: calc(100vw - 260px);
    box-sizing: border-box;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.page-title h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 8px 16px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background-color: #e0f2fe;
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
}

.user-role {
    font-size: 10px;
    color: var(--text-muted);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: var(--danger);
}

/* --- TABS --- */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* --- GEOGRAPHIC ACCORDION TREE LAYOUT --- */
.geo-split-layout {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.geo-main-panel {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.geo-main-panel .panel-body {
    padding: 14px;
}

.geo-main-panel .table th,
.geo-main-panel .table td {
    padding: 8px 6px;
}

.geo-tree-sidebar {
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 10px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: break-word;
}

.geo-tree-sidebar * {
    max-width: 100%;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: break-word;
}

.geo-tree-sidebar.collapsed {
    display: none;
}

.geo-tree-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.geo-tree-all-btn {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.geo-tree-all-btn:hover,
.geo-tree-all-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tree-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tree-node {
    margin-bottom: 4px;
}

.tree-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.15s ease;
}

.tree-header:hover {
    background: #f8fafc;
}

.tree-header.active {
    background: #e0f2fe;
    color: #0369a1;
}

.tree-sublist {
    list-style: none;
    padding-left: 20px;
    margin-top: 2px;
    margin-bottom: 6px;
    display: none;
}

.tree-sublist.open {
    display: block;
}

.tree-subitem {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.tree-subitem:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.tree-subitem.active {
    background: #0284c7;
    color: white;
}

.badge-counter {
    background: #e2e8f0;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
}

.tree-header.active .badge-counter,
.tree-subitem.active .badge-counter {
    background: white;
    color: #0369a1;
}

.geo-main-panel {
    flex: 1;
    min-width: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- KPI CARDS & GRID --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.kpi-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.bg-gold {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.bg-amber {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.bg-blue {
    background: linear-gradient(135deg, #0284c7, #0369a1);
}

.bg-emerald {
    background: linear-gradient(135deg, #10b981, #047857);
}

.bg-purple {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

.kpi-data {
    display: flex;
    flex-direction: column;
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

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

/* --- PANELS & TABLES --- */
.panel {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h3 {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-body {
    padding: 20px;
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    display: block;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

#ordiniTable,
#consegneTable,
#ddtTable {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
}

#ordiniTable th,
#ordiniTable td,
#consegneTable th,
#consegneTable td,
#ddtTable th,
#ddtTable td {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    word-break: break-word !important;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th {
    background-color: #f8fafc;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.sortable-th {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sortable-th:hover {
    background-color: #e2e8f0;
    color: var(--primary);
}

.sortable-th i {
    margin-left: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.sortable-th.active-sort {
    color: var(--primary);
}

.sortable-th.active-sort i {
    color: var(--primary);
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* --- BADGES & BUTTONS --- */
.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.badge-gold {
    background-color: #fef3c7;
    color: #b45309;
}

.badge-blue {
    background-color: #e0f2fe;
    color: #0369a1;
}

.badge-emerald {
    background-color: #d1fae5;
    color: #047857;
}

.badge-gray {
    background-color: #f1f5f9;
    color: #475569;
}

.bg-warning {
    background-color: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #fde68a;
}

.bg-success {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    border: 1px solid #a7f3d0;
}

.text-dark {
    color: #1e293b !important;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: #f1f5f9;
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 12px;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-action {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    color: var(--text-secondary);
}

.btn-action:hover {
    background-color: #f1f5f9;
    color: var(--primary);
}

.btn-action.delete:hover {
    background-color: #fef2f2;
    color: var(--danger);
}

/* --- TOOLBAR & INPUTS --- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 10px 32px 10px 38px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    background: white;
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
}

.search-clear-btn:hover {
    color: var(--danger);
    background: #fef2f2;
}

.filters {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.highlight-input {
    border-color: #f59e0b;
    font-weight: 700;
    color: #b45309;
}

.input-incomplete-warning {
    border: 2px solid #ef4444 !important;
    background-color: #fef2f2 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.audit-warning-banner {
    background: #fffbebf5;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #92400e;
    font-weight: 500;
}

/* --- PAGINATION --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

.pagination-pages {
    display: flex;
    gap: 4px;
}

.page-btn {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
}

.page-btn.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* --- MODALS --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999999 !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-lg {
    max-width: 1100px;
    width: 92vw;
}

.modal-xl {
    max-width: 1200px;
    width: 95vw;
    max-height: 92vh;
}

.bom-subtabs-bar {
    display: flex;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 16px;
}

.bom-tab-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-weight: 600;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bom-tab-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.bom-tab-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.bom-tab-content {
    display: none;
}

.bom-tab-content.active {
    display: block;
}

.bom-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.bom-table th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 600;
    font-size: 12px;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    text-align: left;
}

.bom-table td {
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    font-size: 13px;
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 130px);
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    background-color: #f8fafc;
}

.tabs-sub {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.subtab {
    padding: 8px 14px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.subtab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.subtab-content {
    display: none;
}

.subtab-content.active {
    display: block;
}

.help-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* --- EMPTY STATE & TOAST --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

.empty-state i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    background-color: #0f172a;
    color: white;
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: slideUp 0.3s ease;
}

.toast.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- ORDER SUMMARY BOX --- */
.order-summary-box {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.summary-line {
    display: flex;
    gap: 24px;
    font-size: 13px;
    color: var(--text-secondary);
}

.summary-line.total {
    font-size: 16px;
    color: var(--text-primary);
    border-top: 2px dashed var(--border-color);
    padding-top: 8px;
    margin-top: 4px;
}

.summary-line.total strong {
    color: #b45309;
    font-size: 18px;
}



/* ==========================================================================
   STILI DI STAMPA A4 (SCHEDE LABORATORIO, DDT, REPORT)
   ========================================================================== */
@media print {
    body * {
        visibility: hidden;
    }

    .modal,
    .modal-content {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: #fff !important;
    }

    #modalSchedaLaboratorio,
    #modalSchedaLaboratorio *,
    #modalSchedaDDT,
    #modalSchedaDDT * {
        visibility: visible;
    }

    #modalSchedaLaboratorio,
    #modalSchedaDDT {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        background: #fff;
    }

    .no-print,
    .close-btn,
    .sidebar,
    .topbar,
    .geo-tree-sidebar,
    .toolbar,
    .pagination {
        display: none !important;
    }

    .printable-scheda {
        padding: 0 !important;
    }
}


/* STILI SPECIALIZZATI PER CATALOGO PRODOTTI & GIOIELLI */
.btn-pill-filter {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    color: #475569;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
}

.btn-pill-filter:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.btn-pill-filter.active {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.badge-emerald {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-indigo {
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-storico {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

/* GEM CHIPS PER TABELLA ARTICOLI */
.gem-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.gem-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
}

.gem-chip-metallo {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.gem-chip-brill {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.gem-chip-zaf {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.gem-chip-rub {
    background: #fdf2f8;
    color: #9d174d;
    border: 1px solid #fbcfe8;
}

.gem-chip-sme {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.gem-chip-perle {
    background: #fafafa;
    color: #52525b;
    border: 1px solid #e4e4e7;
}

.gem-chip-semip {
    background: #faf5ff;
    color: #6b21a8;
    border: 1px solid #e9d5ff;
}

/* MINIATURE FOTO ARTICOLO */
.art-thumb-box {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 13px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.art-thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.art-thumb-box:hover {
    border-color: #3b82f6;
}


/* FLOATING HOVER PREVIEW PER FOTO ARTICOLI */
#imageHoverPreview {
    position: fixed;
    z-index: 99999;
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    display: none;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.15s ease, transform 0.15s ease;
    width: 240px;
}

#imageHoverPreview.visible {
    display: block;
    opacity: 1;
    transform: scale(1);
}

#imageHoverPreview .hover-img-wrapper {
    width: 100%;
    height: 220px;
    background: #020617;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 6px;
}

#imageHoverPreview .hover-img-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#imageHoverPreview .hover-info {
    font-size: 11px;
    line-height: 1.3;
}

#imageHoverPreview .hover-title {
    font-weight: 700;
    color: #38bdf8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#imageHoverPreview .hover-sub {
    color: #94a3b8;
    font-size: 10px;
    display: flex;
    justify-content: space-between;
    margin-top: 2px;
}


/* ==============================================================================
   TIMELINE AUDIT TRAIL GIOIELLI & LAVORAZIONI
   ============================================================================== */
.timeline-container {
    position: relative;
    padding-left: 28px;
    margin-top: 14px;
}

.timeline-container::before {
    content: '';
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 10px;
    width: 2px;
    background: #e2e8f0;
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -28px;
    top: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #3b82f6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.timeline-marker.marker-create {
    border-color: #10b981;
    color: #10b981;
}

.timeline-marker.marker-terzista {
    border-color: #f59e0b;
    color: #f59e0b;
}

.timeline-marker.marker-status {
    border-color: #8b5cf6;
    color: #8b5cf6;
}

.timeline-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    transition: all 0.15s ease;
}

.timeline-card:hover {
    background: #fff;
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 12px;
}

.timeline-operator {
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline-time {
    color: #64748b;
    font-size: 11px;
}

.timeline-body {
    font-size: 12.5px;
    color: #334155;
    line-height: 1.45;
}

.timeline-diff-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
}

/* ==============================================================================
   SUBTABS GESTIONALI
   ============================================================================== */
.subtabs-bar {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.subtab-btn {
    border: none;
    background: #e2e8f0;
    color: #475569;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.subtab-btn:hover {
    background: #cbd5e1;
    color: #0f172a;
}

.subtab-btn.active {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

/* ==============================================================================
   BADGES RUOLI UTENTI & TERZISTI
   ============================================================================== */
.badge-role {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-role-admin {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.badge-role-produzione {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.badge-role-commerciale {
    background: #e0e7ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
}

.badge-role-contabilita {
    background: #f3e8ff;
    color: #6b21a8;
    border: 1px solid #e9d5ff;
}

.badge-role-terzista {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ==============================================================================
   PORTALE ARTIGIANI & TERZISTI CARDS
   ============================================================================== */
.terzista-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.terzista-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.terzista-card-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.terzista-thumb-box {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.terzista-thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.terzista-actions {
    display: flex;
    gap: 6px;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}


/* ==============================================================================
   FIX LAYOUT TABELLA ARTICOLI E SIDEBAR ALBERO (ANTI-OVERLAP DEFINITIVO)
   ============================================================================== */
.geo-split-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.geo-tree-sidebar {
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    flex-shrink: 0;
}

.geo-main-panel {
    flex: 1;
    min-width: 0;
    /* Permette il corretto calcolo del flex senza sfondamento */
}

/* Pulsanti filtro a pillola nello stato catalogo e provenienza */
.btn-pill-filter {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    white-space: nowrap;
}

.btn-pill-filter:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-pill-filter.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-pill-filter .badge-counter {
    margin-left: 4px;
    font-size: 10px;
    background: #e2e8f0;
    color: #475569;
    padding: 1px 6px;
    border-radius: 10px;
    transition: all 0.15s ease;
}

.btn-pill-filter.active .badge-counter {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.pill-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.pill-filter-bar-sub {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
}

/* Tabella Articoli: larghezze fisse e anti-sovrapposizione */
#articoliTable {
    table-layout: auto;
    width: 100%;
}

#articoliTable th,
#articoliTable td {
    padding: 10px 8px;
    vertical-align: middle;
}

#articoliTable td:nth-child(1) {
    width: 48px;
    text-align: center;
}

/* Foto */
#articoliTable td:nth-child(2) {
    width: 75px;
    font-weight: 700;
    white-space: nowrap;
}

/* Codice */
#articoliTable td:nth-child(3) {
    width: 70px;
    white-space: nowrap;
}

/* Modello */
#articoliTable td:nth-child(4) {
    min-width: 110px;
}

/* Descrizione */
#articoliTable td:nth-child(5) {
    min-width: 130px;
    font-size: 12px;
}

/* Metallo & Gemme */
#articoliTable td:nth-child(6) {
    width: 65px;
    white-space: nowrap;
}

/* Grammi */
#articoliTable td:nth-child(7) {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Origine/Fornitore */
#articoliTable td:nth-child(8) {
    width: 80px;
    text-align: right;
    white-space: nowrap;
    font-weight: 700;
}

/* Prezzo */
#articoliTable td:nth-child(9) {
    width: 85px;
    white-space: nowrap;
    font-size: 11.5px;
    color: #64748b;
}

/* Modificato */
#articoliTable td:nth-child(10) {
    width: 80px;
    text-align: right;
    white-space: nowrap;
}

/* Azioni */


/* ==============================================================================
   CENTRO STAMPE & CARTELLINI TERMICIE GIOIELLI (PRINT ENGINE)
   ============================================================================== */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
}

.search-dropdown-item {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease;
}

.search-dropdown-item:hover {
    background: #f8fafc;
}

/* Stili Cartellini in Anteprima ed in Stampa */
.label-preview-wrapper {
    background: #fff;
    color: #000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Cartellino con Coda / Filo (2 ante 24x14 mm unite da ponte) */
.cartellino-coda-box {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 3px;
    padding: 3px 5px;
    box-sizing: border-box;
}

.cartellino-anta {
    width: 50%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2px 4px;
    box-sizing: border-box;
}

.cartellino-anta.left {
    border-right: 1px dashed #cbd5e1;
}

/* @media print isolamento per stampa ad altissima fedeltà */
@media print {
    body * {
        visibility: hidden !important;
    }

    #stampePrintArea,
    #stampePrintArea * {
        visibility: visible !important;
    }

    #stampePrintArea {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
    }

    .label-preview-wrapper {
        box-shadow: none !important;
        border: none !important;
        page-break-inside: avoid !important;
    }
}


/* ===== ARTICOLI TABLE: DROPDOWN AZIONI ===== */
.btn-action-menu {
    background: none;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    padding: 3px 9px !important;
    cursor: pointer;
    color: #64748b;
    font-size: 18px;
    line-height: 1;
    transition: all 0.15s ease;
    font-weight: 700;
    letter-spacing: 1px;
}

.btn-action-menu:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    color: #1e293b;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.art-dropdown-menu {
    position: fixed;
    z-index: 9999;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.06);
    min-width: 195px;
    overflow: hidden;
    animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.art-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 14px;
    background: none;
    border: none;
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
}


    /* ===== ARTICOLI TABLE: DROPDOWN AZIONI ===== */
    .btn-action-menu {
        background: none;
        border: 1px solid #e2e8f0 !important;
        border-radius: 6px !important;
        padding: 3px 9px !important;
        cursor: pointer;
        color: #64748b;
        font-size: 18px;
        line-height: 1;
        transition: all 0.15s ease;
        font-weight: 700;
        letter-spacing: 1px;
    }

    .btn-action-menu:hover {
        background: #f1f5f9 !important;
        border-color: #94a3b8 !important;
        color: #1e293b;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    }

    .art-dropdown-menu {
        position: fixed;
        z-index: 9999;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        box-shadow: 0 8px 32px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.06);
        min-width: 195px;
        overflow: hidden;
        animation: dropdownFadeIn 0.15s ease;
    }

    @keyframes dropdownFadeIn {
        from {
            opacity: 0;
            transform: translateY(-4px) scale(0.97);
        }

        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }

    .art-menu-item {
        display: flex;
        align-items: center;
        gap: 9px;
        width: 100%;
        padding: 9px 14px;
        background: none;
        border: none;
        text-align: left;
        font-size: 13px;
        font-weight: 500;
        color: #334155;
        cursor: pointer;
        transition: background 0.12s ease;
        font-family: inherit;
    }

    .art-menu-item:hover {
        background: #f8fafc;
    }

    .art-menu-item i {
        font-size: 13px;
        flex-shrink: 0;
    }

    #articoliTable {
        table-layout: fixed;
    }

    #articoliTable td {
        padding: 8px 7px;
        vertical-align: middle;
        overflow: hidden;
    }

    #articoliTable .art-thumb-box {
        width: 34px;
        height: 34px;
    }

    /* ==============================================================================
   BARRA NAVIGAZIONE ORIZZONTALE ANNI & DROPDOWN MOUSEOVER HOVER
   ============================================================================== */
    .horizontal-year-nav {
        display: flex;
        align-items: center;
        gap: 10px;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        padding: 8px 14px;
        margin-bottom: 16px;
        flex-wrap: wrap;
    }

    .horizontal-year-nav .nav-label {
        font-weight: 700;
        font-size: 13px;
        color: #475569;
        margin-right: 4px;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .horizontal-year-nav .nav-btn-group {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
    }

    .year-dropdown-wrapper {
        position: relative;
        display: inline-block;
    }

    .year-dropdown-btn {
        background: #ffffff;
        border: 1px solid #cbd5e1;
        color: #334155;
        font-size: 13px;
        font-weight: 600;
        padding: 6px 12px;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.2s ease;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .year-dropdown-btn:hover,
    .year-dropdown-wrapper:hover .year-dropdown-btn {
        background: #2563eb;
        color: #ffffff;
        border-color: #2563eb;
        box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
    }

    .year-dropdown-btn.active {
        background: #1e40af;
        color: #ffffff;
        border-color: #1e40af;
        font-weight: 700;
    }

    .year-dropdown-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        margin-top: 4px;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
        z-index: 1050;
        min-width: 150px;
        padding: 6px 0;
    }

    .year-dropdown-wrapper:hover .year-dropdown-menu {
        display: block;
        animation: dropdownFadeIn 0.15s ease-out;
    }

    .year-dropdown-menu .dropdown-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 7px 14px;
        font-size: 12px;
        font-weight: 500;
        color: #334155;
        text-decoration: none;
        cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease;
    }

    .year-dropdown-menu .dropdown-item:hover {
        background: #eff6ff;
        color: #2563eb;
        font-weight: 600;
    }

    /* SWITCHER VISTA CONSEGNE vs SOSPESI */
    .view-switcher-group {
        display: inline-flex;
        background: #e2e8f0;
        border-radius: 8px;
        padding: 3px;
        gap: 2px;
    }

    .btn-switcher {
        border: none;
        background: transparent;
        padding: 6px 14px;
        border-radius: 6px;
        font-size: 12px;
        font-weight: 600;
        color: #64748b;
        cursor: pointer;
        transition: all 0.2s ease;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .btn-switcher:hover {
        color: #1e293b;
    }

    .btn-switcher.active {
        background: #ffffff;
        color: #2563eb;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        font-weight: 700;
    }

    /* ==============================================================================
   REGOLE CSS NAVIGAZIONE ORIZZONTALE E DROPDOWN CUSTOM
   ============================================================================== */
    .year-nav-container {
        display: flex;
        align-items: center;
        gap: 8px;
        background-color: #f8f9fa;
        padding: 10px 15px;
        border-radius: 6px;
        border: 1px solid #dee2e6;
        margin-bottom: 15px;
        flex-wrap: wrap;
    }

    .year-nav-label {
        font-weight: bold;
        color: #495057;
        margin-right: 10px;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .year-dropdown {
        position: relative;
        display: inline-block;
    }

    .year-btn {
        background-color: #ffffff;
        border: 1px solid #ced4da;
        color: #334155;
        padding: 6px 12px;
        border-radius: 4px;
        cursor: pointer;
        font-weight: 500;
        font-size: 13px;
        transition: all 0.2s ease;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .year-btn:hover,
    .year-dropdown:hover .year-btn {
        background-color: #0d6efd;
        color: #ffffff;
        border-color: #0d6efd;
        box-shadow: 0 2px 6px rgba(13, 110, 253, 0.25);
    }

    .year-btn.active {
        background-color: #0b5ed7;
        color: #ffffff;
        border-color: #0a58ca;
        font-weight: 700;
    }

    .dropdown-menu-custom {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 1000;
        min-width: 140px;
        background-color: #ffffff;
        border: 1px solid rgba(0, 0, 0, .15);
        border-radius: 6px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
        padding: 5px 0;
        margin-top: 4px;
    }

    .year-dropdown:hover .dropdown-menu-custom {
        display: block;
        animation: dropdownFadeIn 0.15s ease-out;
    }

    .dropdown-menu-custom a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 6px 12px;
        color: #212529;
        text-decoration: none;
        font-size: 0.85rem;
        font-weight: 500;
        cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease;
    }

    .dropdown-menu-custom a:hover {
        background-color: #e9ecef;
        color: #0d6efd;
        font-weight: 600;
    }

    /* ==============================================================================
   CATEGORIE PIETRE SCIOLTE - NAVIGAZIONE ORIZZONTALE & ROLLOVER/HOVER DRAWER
   ============================================================================== */
    .pietre-subfilters-container {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 16px;
        padding: 12px 16px;
        background: #ffffff;
        border: 1px solid #cbd5e1;
        border-radius: 10px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    }

    .pietre-header-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        border-bottom: 1px solid #f1f5f9;
        padding-bottom: 6px;
    }

    .pietre-parents-grid {
        display: flex;
        flex-direction: row;
        gap: 10px;
        align-items: flex-start;
        flex-wrap: wrap;
        width: 100%;
    }

    .pietre-parent-card {
        position: relative;
        display: inline-flex;
        flex-direction: column;
        align-items: flex-start;
        border-radius: 8px;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .pietre-parent-btn {
        background-color: #f8fafc;
        border: 1px solid #cbd5e1;
        color: #1e293b;
        padding: 7px 14px;
        border-radius: 8px;
        cursor: pointer;
        font-weight: 600;
        font-size: 12.5px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        transition: all 0.25s ease;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    }

    .pietre-parent-btn:hover,
    .pietre-parent-card:hover .pietre-parent-btn,
    .pietre-parent-card.expanded .pietre-parent-btn {
        background-color: #eff6ff;
        color: #1d4ed8;
        border-color: #93c5fd;
        box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
        transform: translateY(-1px);
    }

    .pietre-parent-btn.active {
        background: linear-gradient(135deg, #2563eb, #1d4ed8);
        color: #ffffff;
        border-color: #1e40af;
        box-shadow: 0 3px 8px rgba(37, 99, 235, 0.25);
        font-weight: 700;
    }

    .pietre-parent-btn.active .badge-count {
        background: rgba(255, 255, 255, 0.25);
        color: #ffffff;
    }

    .badge-count {
        background: #e0f2fe;
        color: #0369a1;
        padding: 2px 7px;
        border-radius: 10px;
        font-size: 10.5px;
        font-weight: 700;
        transition: all 0.2s ease;
    }

    /* Sottocategorie espandibili in ORIZZONTALE - FULL WIDTH NASCOSTE DI DEFAULT */
    .pietre-sub-drawer {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px !important;
        flex-wrap: wrap !important;
        overflow-x: auto !important;
        width: 100% !important;
        margin-top: 8px !important;
        padding: 10px 14px !important;
        background: #f8fafc !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 8px !important;
        transition: opacity 0.25s ease !important;
    }

    /* Visibilità al rollover (hover) o al click (classe show / active-drawer) */
    .pietre-sub-drawer.show,
    .pietre-sub-drawer.active-drawer {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .btn-sub-pill {
        background-color: #ffffff;
        border: 1px solid #cbd5e1;
        color: #334155;
        padding: 5px 12px;
        border-radius: 6px;
        font-size: 12px;
        font-weight: 500;
        cursor: pointer;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        transition: all 0.2s ease;
    }

    .btn-sub-pill:hover {
        background-color: #2563eb;
        color: #ffffff;
        border-color: #2563eb;
        transform: translateY(-1px);
        box-shadow: 0 2px 5px rgba(37, 99, 235, 0.2);
    }

    .btn-sub-pill:hover .sub-count-badge {
        background: rgba(255, 255, 255, 0.25);
        color: #ffffff;
    }

    .btn-sub-pill.active {
        background-color: #0f172a;
        color: #ffffff;
        border-color: #0f172a;
        font-weight: 700;
    }

    .btn-sub-pill.active .sub-count-badge {
        background: #38bdf8;
        color: #0f172a;
    }

    .sub-count-badge {
        background: #f1f5f9;
        color: #475569;
        padding: 1px 6px;
        border-radius: 8px;
        font-size: 10px;
        font-weight: 700;
    }