:root {
    --brand-navy: #0f2942;
    --brand-navy-light: #163654;
    --brand-blue: #1e40af;
    --brand-blue-hover: #1d4ed8;
    --brand-gold: #f59e0b;
    --brand-gold-hover: #d97706;
    --brand-gold-light: #fef3c7;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-width: 270px;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Sidebar Silos */
.sidebar {
    width: var(--sidebar-width);
    background: var(--brand-navy);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand .brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--brand-gold) 0%, #b45309 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.35rem;
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

.sidebar-brand .brand-text {
    color: #ffffff;
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1.2;
}

.sidebar-brand .brand-text span {
    color: var(--brand-gold);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    font-weight: 600;
}

.sidebar-menu {
    padding: 1.25rem 0.75rem;
    flex-grow: 1;
    overflow-y: auto;
}

.nav-section-title {
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 0.85rem 0.75rem 0.35rem;
}

.sidebar-menu .nav-link {
    color: #cbd5e1;
    font-weight: 500;
    font-size: 0.92rem;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
}

.sidebar-menu .nav-link i {
    font-size: 1.15rem;
    color: #94a3b8;
    transition: color 0.2s;
}

.sidebar-menu .nav-link:hover {
    background-color: var(--brand-navy-light);
    color: #ffffff;
}

.sidebar-menu .nav-link:hover i {
    color: var(--brand-gold);
}

.sidebar-menu .nav-link.active {
    background: linear-gradient(90deg, rgba(30, 64, 175, 0.6) 0%, rgba(30, 64, 175, 0.2) 100%);
    color: #ffffff;
    font-weight: 600;
    border-left: 4px solid var(--brand-gold);
}

.sidebar-menu .nav-link.active i {
    color: var(--brand-gold);
}

/* User Card in Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #ffffff;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--brand-blue);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    border: 2px solid var(--brand-gold);
}

.user-info {
    flex-grow: 1;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-tag {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    display: inline-block;
}

.role-admin { background-color: #ef4444; color: #fff; }
.role-gestore { background-color: #f59e0b; color: #000; }
.role-dipendente { background-color: #3b82f6; color: #fff; }

/* Main Content Area */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

.content-body {
    padding: 1.75rem;
    flex-grow: 1;
}

/* Cards & Components */
.card-custom {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    margin-bottom: 1.5rem;
}

.card-custom .card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.1rem 1.35rem;
    font-weight: 700;
    color: var(--brand-navy);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-custom .card-body {
    padding: 1.35rem;
}

/* Buttons */
.btn-primary {
    background-color: var(--brand-blue);
    border-color: var(--brand-blue);
    font-weight: 600;
    padding: 0.55rem 1.25rem;
    border-radius: 8px;
}

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

.btn-gold {
    background-color: var(--brand-gold);
    border-color: var(--brand-gold);
    color: #ffffff;
    font-weight: 600;
    padding: 0.55rem 1.25rem;
    border-radius: 8px;
}

.btn-gold:hover {
    background-color: var(--brand-gold-hover);
    border-color: var(--brand-gold-hover);
    color: #ffffff;
}

/* Stat Widgets */
.stat-widget {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.05);
}

.stat-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon-blue { background: #dbeafe; color: var(--brand-blue); }
.stat-icon-gold { background: var(--brand-gold-light); color: var(--brand-gold); }
.stat-icon-green { background: #dcfce7; color: #16a34a; }
.stat-icon-purple { background: #f3e8ff; color: #9333ea; }

.stat-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Tables */
.table-custom {
    margin-bottom: 0;
}

.table-custom th {
    background-color: #f1f5f9;
    color: #475569;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

.table-custom td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* Counter button for production */
.counter-box {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    padding: 2rem;
    text-align: center;
}

.counter-value {
    font-size: 4.5rem;
    font-weight: 900;
    color: var(--brand-navy);
    line-height: 1;
    margin: 1rem 0;
}

/* Chat styles */
.chat-container {
    height: 580px;
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
}

.chat-sidebar {
    width: 250px;
    border-right: 1px solid var(--border-color);
    background: #f8fafc;
    display: flex;
    flex-direction: column;
}

.chat-channel-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text-main);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background 0.2s;
}

.chat-channel-item:hover, .chat-channel-item.active {
    background: #e2e8f0;
    border-left-color: var(--brand-blue);
    font-weight: 600;
}

.chat-messages-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.chat-history {
    flex-grow: 1;
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: #ffffff;
}

.chat-msg {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.92rem;
    position: relative;
}

.chat-msg-in {
    background: #f1f5f9;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-msg-out {
    background: var(--brand-blue);
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-msg-meta {
    font-size: 0.72rem;
    margin-top: 0.35rem;
    opacity: 0.75;
}

.chat-input-bar {
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .sidebar {
        left: -100%;
    }
    .sidebar.open {
        left: 0;
    }
    .main-wrapper {
        margin-left: 0;
    }
}
EOF
