/* ========================================
   EL - DIGITAL MARKETING - GESTIONALE COLLABORATORI
   Design System v2.0
   ======================================== */
:root {
  --bg-dark: #0f172a;
  --bg-dark2: #1e293b;
  --bg-dark3: #334155;
  --sidebar-w: 260px;
  --accent: #f97316;
  --accent-hover: #ea6c00;
  --accent2: #3b82f6;
  --accent2-hover: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;
  --pink: #ec4899;
  --teal: #14b8a6;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: rgba(255, 255, 255, 0.08);
  --card-bg: rgba(255, 255, 255, 0.04);
  --card-hover: rgba(255, 255, 255, 0.08);
  --glass: rgba(255, 255, 255, 0.05);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --radius: 12px;
  --radius-lg: 16px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-dark3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent2);
}

/* ===== LAYOUT ===== */
#app-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
#sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0f172a 0%, #1a1f35 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: var(--transition);
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.sidebar-logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent), #fb923c);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.sidebar-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

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

/* ===== NAV MENU ===== */
#nav-menu {
  flex: 1;
  padding: 12px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  transition: var(--transition);
  text-align: left;
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: var(--card-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(251, 146, 60, 0.1));
  color: var(--accent);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

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

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* ===== MAIN CONTENT ===== */
#main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== TOPBAR ===== */
#topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

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

.topbar-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#btn-hamburger {
  display: none;
  width: 36px;
  height: 36px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ===== PAGE CONTENT ===== */
#main-content {
  flex: 1;
  padding: 28px;
  max-width: 1400px;
  width: 100%;
}

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== STATS CARDS ===== */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.08;
}

.stat-card.orange::after {
  background: var(--accent);
}

.stat-card.blue::after {
  background: var(--accent2);
}

.stat-card.green::after {
  background: var(--success);
}

.stat-card.purple::after {
  background: var(--purple);
}

.stat-card.pink::after {
  background: var(--pink);
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}

.badge-copywriting {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.badge-video {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.badge-adv {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.badge-grafica {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.badge-in_progress {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.badge-completed {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.badge-blocked {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.badge-on_hold {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
}

.badge-cancelled {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
}

.badge-inactive {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
}

.badge-low {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
}

.badge-medium {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.badge-high {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
}

.badge-urgent {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.badge-admin {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
}

.badge-collaborator {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.badge-copywriter {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.badge-videomaker {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.badge-advertiser {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.badge-web_developer {
  background: rgba(20, 184, 166, 0.15);
  color: #2dd4bf;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #fb923c);
  color: #fff;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(249, 115, 22, 0.4);
}

.btn-secondary {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

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

.btn-blue {
  background: linear-gradient(135deg, var(--accent2), #6366f1);
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-blue:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

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

.btn-icon {
  padding: 8px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

/* ===== TABLES ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 13px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--card-bg);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* ===== FORMS ===== */
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text-primary);
  font-family: var(--font);
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent2);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input option {
  background: #1e293b;
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 16px;
}

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: #1a2236;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.25s ease;
}

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
}

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

.btn-modal-close {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-modal-close:hover {
  background: var(--card-hover);
  color: var(--text-primary);
}

/* ===== NOTIFICATIONS ===== */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  max-width: 360px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-success {
  background: rgba(16, 185, 129, 0.9);
  color: #fff;
}

.toast-error {
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
}

.toast-info {
  background: rgba(59, 130, 246, 0.9);
  color: #fff;
}

.toast-warning {
  background: rgba(245, 158, 11, 0.9);
  color: #fff;
}

/* ===== CHAT PANEL ===== */
#chat-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 360px;
  z-index: 150;
  background: #1a2236;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
}

#chat-panel.open {
  transform: translateX(0);
}

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

.chat-tabs {
  display: flex;
  gap: 4px;
  background: var(--card-bg);
  border-radius: 8px;
  padding: 3px;
}

.chat-tab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  color: var(--text-muted);
  background: transparent;
  transition: var(--transition);
}

.chat-tab.active {
  background: var(--accent);
  color: #fff;
}

.chat-user-list {
  overflow-y: auto;
  flex: 1;
}

.chat-user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.chat-user-item:hover {
  background: var(--card-bg);
}

.chat-user-item.active {
  background: rgba(249, 115, 22, 0.1);
}

.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.chat-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-last-msg {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 90%;
}

.chat-msg.own {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.chat-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.chat-msg-bubble {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 4px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

.chat-msg.own .chat-msg-bubble {
  background: rgba(249, 115, 22, 0.15);
  border-color: rgba(249, 115, 22, 0.2);
  border-radius: 12px 12px 4px 12px;
}

.chat-msg-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
}

.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font);
  resize: none;
  outline: none;
  max-height: 80px;
  transition: var(--transition);
}

.chat-input:focus {
  border-color: var(--accent);
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), #fb923c);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-muted);
}

.upload-zone.drag-over {
  border-color: var(--accent2);
  background: rgba(59, 130, 246, 0.05);
  color: var(--accent2);
}

.upload-zone:hover {
  border-color: var(--text-muted);
  color: var(--text-secondary);
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}

.file-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.file-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.file-size {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== LOGIN ===== */
#login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 20% 50%, rgba(249, 115, 22, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    var(--bg-dark);
  position: relative;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--accent), #fb923c);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
  margin: 0 auto 14px;
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.4);
}

.login-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== MOBILE OVERLAY ===== */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0, 0, 0, 0.6);
}

/* ===== MOBILE BOTTOM NAV ===== */
#bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-dark2);
  border-top: 1px solid var(--border);
  z-index: 98;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-items {
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 12px;
  border: none;
  background: none;
  transition: var(--transition);
}

.bottom-nav-item i {
  font-size: 18px;
}

.bottom-nav-item.active {
  color: var(--accent);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
  }

  #sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
  }

  #main-wrapper {
    margin-left: 0;
  }

  #btn-hamburger {
    display: flex;
  }

  #main-content {
    padding: 12px;
    padding-bottom: 80px;
  }

  #sidebar-overlay.visible {
    display: block;
  }

  #bottom-nav {
    display: block;
  }

  #chat-panel {
    width: 100%;
  }

  .modal {
    max-width: 100%;
    margin: 0;
  }

  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    border-radius: 16px 16px 0 0;
  }

  .topbar-title {
    display: none;
  }

  #topbar {
    padding: 0 12px;
  }

  .topbar-right {
    gap: 4px;
  }

  .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .sidebar-user {
    margin-top: 10px;
  }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }

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

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-dark3);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  transition: width 0.5s ease;
  border-radius: 3px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 13px;
}

/* ===== PROJECT CARDS ===== */
.project-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  cursor: pointer;
}

.project-card:hover {
  border-color: rgba(249, 115, 22, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ===== TASK CARDS ===== */
.task-row {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 6px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  gap: 12px;
  transition: var(--transition);
  flex-wrap: wrap;
  /* Importante per mobile: va a capo */
}

.task-row:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* ===== PROFILE AVATAR ===== */
.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ===== NOTIFICATIONS PANEL ===== */
#notif-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 320px;
  background: #1a2236;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 200;
  overflow: hidden;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  transition: var(--transition);
}

.notif-item:hover {
  background: var(--card-bg);
}

.notif-item.unread {
  background: rgba(249, 115, 22, 0.05);
}

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

/* ===== RESPONSIVE GRID ===== */
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

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

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

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

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

@media (max-width: 900px) {

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

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

@media (max-width: 600px) {

  .grid-5,
  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .grid-auto {
    grid-template-columns: 1fr;
  }
}

/* ===== UTILITY ===== */
.text-orange {
  color: var(--accent);
}

.text-blue {
  color: var(--accent2);
}

.text-green {
  color: var(--success);
}

.text-red {
  color: var(--danger);
}

.text-purple {
  color: var(--purple);
}

.text-muted {
  color: var(--text-muted);
}

.text-sm {
  font-size: 12px;
}

.text-xs {
  font-size: 11px;
}

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.gap-1 {
  gap: 4px;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.flex-1 {
  flex: 1;
}

.w-full {
  width: 100%;
}

.mb-1 {
  margin-bottom: 4px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 12px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mb-6 {
  margin-bottom: 24px;
}

.mt-1 {
  margin-top: 4px;
}

.mt-2 {
  margin-top: 8px;
}

/* ===== RESPONSIVE HELPERS ===== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .hide-on-mobile {
    display: none !important;
  }

  /* Trasforma le Tabelle in Layout a Card */
  /* NOTA BENE: table-responsive NON modifica più l'overflow per non spaccare il calendario */

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table {
    border: none !important;
    min-width: 0 !important;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--card-bg);
  }

  .data-table td {
    padding: 8px 0;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
  }

  .data-table td:last-child {
    border-bottom: none;
    justify-content: flex-end;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-align: left;
    margin-right: 16px;
  }
}

/* ========================================
   ADMIN FILE BROWSER (Google Drive)
   ======================================== */

.admin-files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  min-height: 200px;
}

.admin-file-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: var(--transition);
  position: relative;
  cursor: default;
}

.admin-file-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: var(--card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.admin-folder-card {
  cursor: pointer;
}

.admin-folder-card:hover {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.05);
}

.admin-file-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.admin-file-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
  margin-bottom: 4px;
}

.admin-file-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.admin-file-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
  flex-wrap: wrap;
  justify-content: center;
}

.admin-file-card:hover .admin-file-actions {
  opacity: 1;
}

.admin-file-actions .btn {
  padding: 4px;
  width: 28px;
  height: 28px;
  font-size: 11px;
}

/* Breadcrumb */
.admin-bc-btn {
  background: none;
  border: none;
  color: var(--accent2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: var(--transition);
}

.admin-bc-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent2-hover);
}

/* Drop Zone */
.admin-drop-zone {
  position: relative;
  min-height: 300px;
}

.admin-drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(99, 102, 241, 0.08);
  border: 3px dashed #6366f1;
  border-radius: var(--radius-lg);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.admin-drop-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-files-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }

  .admin-file-card {
    padding: 12px;
  }

  .admin-file-icon {
    width: 48px;
    height: 48px;
  }

  .admin-file-icon i {
    font-size: 28px !important;
  }

  .admin-file-actions {
    opacity: 1;
  }
}