:root {
  --sidebar-width: 220px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f0f2f5;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-height: calc(100vh - 56px);
  position: sticky;
  top: 56px;
}

.sidebar-link {
  color: rgba(255,255,255,0.7) !important;
  border-radius: 8px;
  padding: 10px 14px;
  transition: all 0.2s;
}
.sidebar-link:hover {
  color: #fff !important;
  background: rgba(255,255,255,0.1);
}
.sidebar-link.active {
  color: #fff !important;
  background: rgba(255,255,255,0.15);
  font-weight: 500;
}

/* Main content */
.main-content {
  min-height: calc(100vh - 56px);
  max-width: 1400px;
}

/* Cards */
.stat-card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: transform 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
}
.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

/* Status badges */
.badge-open { background: #3b82f6; }
.badge-in_progress { background: #f59e0b; }
.badge-resolved { background: #10b981; }
.badge-closed { background: #6b7280; }

.badge-low { background: #6b7280; }
.badge-medium { background: #3b82f6; }
.badge-high { background: #f59e0b; }
.badge-critical { background: #ef4444; }

/* Ticket list */
.ticket-row {
  cursor: pointer;
  transition: background 0.15s;
}
.ticket-row:hover {
  background: #f0f4ff !important;
}

/* Messages */
.message-bubble {
  max-width: 85%;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
}
.message-user {
  background: #e8f0fe;
  margin-left: auto;
}
.message-admin {
  background: #fff;
  border: 1px solid #e5e7eb;
}
.message-meta {
  font-size: 0.8rem;
  color: #6b7280;
}
.message-content {
  white-space: pre-wrap;
  word-break: break-word;
}

/* Attachments */
.attachment-preview {
  max-width: 200px;
  max-height: 150px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #e5e7eb;
}
.attachment-preview:hover {
  opacity: 0.9;
}

/* Tables */
.table th {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
}

/* Ticket detail */
.ticket-header {
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 16px;
  margin-bottom: 16px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}
.empty-state i {
  font-size: 3rem;
  margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }
  .sidebar .nav-link span,
  .sidebar-link {
    font-size: 0;
  }
  .sidebar-link i {
    font-size: 1.2rem !important;
    margin: 0 !important;
  }
  .main-content {
    padding: 16px !important;
  }
}

/* Loading spinner */
.spinner-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* File upload area */
.upload-area {
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}
.upload-area:hover,
.upload-area.dragover {
  border-color: #3b82f6;
  background: #f0f4ff;
}
.upload-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.upload-preview img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 10000;
}
