/* Deadlock Connect - Main CSS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #2563EB;
  --primary-light: #3B82F6;
  --primary-dark: #1D4ED8;
  --sidebar-bg: #0F172A;
  --page-bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --border: #E2E8F0;
  --sidebar-text: #94A3B8;
  --sidebar-active: #FFFFFF;
  --radius-card: 14px;
  --radius-btn: 9px;
  --radius-input: 9px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.04);
  --transition: 0.2s ease;
  --sidebar-width: 260px;
  --sidebar-collapsed: 68px;
  --header-height: 64px;
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--page-bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  line-height: 1.3;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: width 0.25s ease;
  display: flex;
  flex-direction: column;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #1E293B; border-radius: 4px; }

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  transition: margin-left 0.25s ease;
  min-width: 0;
}
.main-content.sidebar-collapsed { margin-left: var(--sidebar-collapsed); }

/* ===================== SIDEBAR ===================== */
.sidebar-logo {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--header-height);
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo .logo-icon svg { width: 20px; height: 20px; color: white; }
.sidebar-logo .logo-text {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 18px; font-weight: 800;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s;
}
.sidebar.collapsed .logo-text { opacity: 0; width: 0; }

.sidebar-nav { padding: 12px 10px; flex: 1; }

.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 10px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s;
}
.sidebar.collapsed .nav-section-title { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: white; text-decoration: none; }
.nav-item.active {
  background: var(--primary);
  color: white;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: white;
  border-radius: 0 2px 2px 0;
  display: none;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .nav-label { transition: opacity 0.2s; }
.sidebar.collapsed .nav-label { opacity: 0; width: 0; overflow: hidden; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.sidebar.collapsed .nav-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  margin-left: 0;
  min-width: 8px;
  width: 8px;
  height: 8px;
  padding: 0;
  font-size: 0;
  border-radius: 50%;
  opacity: 1;
}

/* Sidebar tooltip for collapsed state */
.sidebar.collapsed .nav-item { justify-content: center; }
.sidebar.collapsed .nav-item svg { margin: 0; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-user:hover { background: rgba(255,255,255,0.07); }
.sidebar-user .user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user .user-info { overflow: hidden; transition: opacity 0.2s; }
.sidebar.collapsed .user-info { opacity: 0; width: 0; }
.sidebar-user .user-name { color: white; font-size: 13px; font-weight: 600; white-space: nowrap; }
.sidebar-user .user-role { color: var(--sidebar-text); font-size: 11px; }

/* ===================== HEADER ===================== */
.app-header {
  background: white;
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-left { display: flex; align-items: center; gap: 16px; flex: 1; }
.header-right { display: flex; align-items: center; gap: 10px; }

.sidebar-toggle {
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.15s;
}
.sidebar-toggle:hover { background: var(--page-bg); color: var(--text-primary); }
.sidebar-toggle svg { width: 20px; height: 20px; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); text-decoration: none; }
.breadcrumb .separator { color: #CBD5E1; }
.breadcrumb .current { color: var(--text-primary); font-weight: 600; }

.header-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  position: relative;
  transition: all 0.15s;
}
.header-btn:hover { border-color: var(--primary); color: var(--primary); }
.header-btn svg { width: 18px; height: 18px; }

.notification-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 17px; height: 17px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}

/* ===================== PAGE CONTENT ===================== */
.page-content { padding: 28px; transition: opacity 0.18s ease, transform 0.18s ease; }

/* SPA progress bar */
#spa-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  opacity: 0;
  background: linear-gradient(90deg, #2563EB 0%, #60A5FA 60%, #93C5FD 100%);
  z-index: 99999;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
  transition: width 0.25s ease, opacity 0.3s ease;
  pointer-events: none;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}
.page-title { font-size: 24px; font-weight: 800; color: var(--text-primary); }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 4px; font-weight: 400; }
.page-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ===================== CARDS ===================== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.card-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.card-body { padding: 22px; }
.card-footer { padding: 14px 22px; border-top: 1px solid var(--border); background: #F8FAFC; }

/* Stat Cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: white;
  border-radius: var(--radius-card);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.2s;
  cursor: default;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.blue { background: #EFF6FF; color: var(--primary); }
.stat-icon.green { background: #F0FDF4; color: var(--success); }
.stat-icon.red { background: #FEF2F2; color: var(--danger); }
.stat-icon.yellow { background: #FFFBEB; color: var(--warning); }
.stat-icon.purple { background: #F5F3FF; color: #7C3AED; }
.stat-icon.gray { background: #F8FAFC; color: var(--text-secondary); }
.stat-icon.orange { background: #FFF7ED; color: #EA580C; }

.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1; font-family: 'Plus Jakarta Sans', sans-serif; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; font-weight: 500; }
.stat-change { font-size: 12px; color: var(--success); margin-top: 4px; font-weight: 600; }
.stat-change.down { color: var(--danger); }

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-btn);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); filter: brightness(1.05); color: white; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(0.95); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(0.95); }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { filter: brightness(0.95); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-primary);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: #EFF6FF; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
}
.btn-ghost:hover { background: var(--page-bg); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }

.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon svg { width: 16px; height: 16px; }

/* ===================== BADGES ===================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background: #DCFCE7; color: #16A34A; }
.badge-danger { background: #FEE2E2; color: #DC2626; }
.badge-warning { background: #FEF3C7; color: #D97706; }
.badge-info { background: #DBEAFE; color: #1D4ED8; }
.badge-gray { background: #F1F5F9; color: #64748B; }
.badge-purple { background: #EDE9FE; color: #7C3AED; }
.badge-orange { background: #FFF7ED; color: #EA580C; }

/* ===================== FORMS ===================== */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
label .req { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-input);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.form-control::placeholder { color: #CBD5E1; }
.form-control:disabled { background: #F8FAFC; color: var(--text-secondary); }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
textarea.form-control { resize: vertical; min-height: 96px; }

.form-hint { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; display: none; }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid + .form-error { display: block; }
.form-control.is-valid { border-color: var(--success); }

/* File Upload */
.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-input);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #FAFBFC;
}
.file-upload-area:hover { border-color: var(--primary); background: #EFF6FF; }
.file-upload-area.dragover { border-color: var(--primary); background: #EFF6FF; }
.file-upload-area input { display: none; }
.file-upload-icon { width: 40px; height: 40px; margin: 0 auto 10px; color: var(--text-secondary); }
.file-upload-text { font-size: 14px; color: var(--text-secondary); }
.file-upload-text strong { color: var(--primary); }
.file-upload-hint { font-size: 12px; color: #94A3B8; margin-top: 4px; }

.img-preview { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; margin-top: 8px; }

/* ===================== TABLES ===================== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: white;
}

table { width: 100%; border-collapse: collapse; }

thead th {
  background: #F8FAFC;
  padding: 13px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { background: #F1F5F9; color: var(--primary); }
thead th .sort-icon { display: inline-block; margin-left: 4px; opacity: 0.4; }
thead th.sorted .sort-icon { opacity: 1; color: var(--primary); }

tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #F8FAFC; }

tbody td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.table-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #E2E8F0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--primary);
  flex-shrink: 0;
}

.table-actions { display: flex; gap: 6px; align-items: center; }
.action-btn {
  width: 32px; height: 32px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.action-btn:hover { border-color: var(--primary); color: var(--primary); background: #EFF6FF; }
.action-btn.danger:hover { border-color: var(--danger); color: var(--danger); background: #FEF2F2; }
.action-btn svg { width: 14px; height: 14px; }

/* Table toolbar */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
  background: white;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}
.table-search { position: relative; }
.table-search input {
  padding: 9px 14px 9px 38px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  outline: none;
  width: 260px;
  transition: border-color 0.15s;
}
.table-search input:focus { border-color: var(--primary); }
.table-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-secondary); }

.table-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-select {
  padding: 8px 32px 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 13px;
  color: var(--text-primary);
  background: white;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s;
}
.filter-select:focus { border-color: var(--primary); }

input[type="date"].filter-select,
input[type="date"].form-control {
  color-scheme: light;
  color: var(--text-primary);
  background: white;
}
input[type="date"].filter-select::-webkit-date-and-time-value {
  color: var(--text-primary);
}
input[type="date"].filter-select::-webkit-datetime-edit,
input[type="date"].filter-select::-webkit-datetime-edit-fields-wrapper,
input[type="date"].filter-select::-webkit-datetime-edit-text,
input[type="date"].filter-select::-webkit-datetime-edit-year-field,
input[type="date"].filter-select::-webkit-datetime-edit-month-field,
input[type="date"].filter-select::-webkit-datetime-edit-day-field {
  color: var(--text-primary);
}

/* Pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  gap: 12px;
  background: white;
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}
.pagination-info { font-size: 13px; color: var(--text-secondary); }
.pagination-controls { display: flex; gap: 4px; }
.page-btn {
  width: 34px; height: 34px;
  border: 1.5px solid var(--border);
  background: white;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: all 0.15s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-btn svg { width: 14px; height: 14px; }

/* ===================== MODALS ===================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 20px;
  backdrop-filter: blur(3px);
  animation: fadeIn 0.15s ease;
}
.modal {
  background: white;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}
.modal-lg { max-width: 800px; }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border: none; background: transparent;
  border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: background 0.15s;
}
.modal-close:hover { background: var(--page-bg); color: var(--text-primary); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px;
}

/* Confirm Modal */
.confirm-modal { max-width: 420px; }
.confirm-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
}
.confirm-icon.danger { background: #FEE2E2; color: var(--danger); }
.confirm-icon.warning { background: #FEF3C7; color: var(--warning); }
.confirm-icon svg { width: 26px; height: 26px; }
.confirm-title { text-align: center; font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.confirm-message { text-align: center; color: var(--text-secondary); font-size: 14px; line-height: 1.6; }

/* ===================== DRAWERS ===================== */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 150;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.15s;
}
.drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: 500px;
  background: white;
  box-shadow: -4px 0 30px rgba(0,0,0,0.12);
  z-index: 151;
  overflow-y: auto;
  animation: slideFromRight 0.2s ease;
  display: flex; flex-direction: column;
}
.drawer-lg { width: 700px; }
.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: white; z-index: 1;
}
.drawer-title { font-size: 17px; font-weight: 700; }
.drawer-body { padding: 24px; flex: 1; }
.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  position: sticky; bottom: 0; background: white;
}

/* ===================== TOAST NOTIFICATIONS ===================== */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  background: white;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
  min-width: 300px;
  max-width: 420px;
  pointer-events: all;
  animation: slideFromRight 0.3s ease;
  border-left: 4px solid;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.info { border-color: var(--primary); }
.toast-icon { width: 20px; height: 20px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--primary); }
.toast-message { flex: 1; font-size: 14px; font-weight: 500; color: var(--text-primary); }
.toast-close { width: 20px; height: 20px; cursor: pointer; color: var(--text-secondary); flex-shrink: 0; }
.toast.hiding { animation: slideOut 0.3s ease forwards; }

/* ===================== EMPTY STATE ===================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-icon {
  width: 80px; height: 80px;
  background: #F1F5F9;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  color: var(--text-secondary);
}
.empty-icon svg { width: 40px; height: 40px; }
.empty-title { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.empty-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; max-width: 360px; margin-left: auto; margin-right: auto; line-height: 1.6; }

/* ===================== LOADING STATES ===================== */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }

.skeleton {
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.4s infinite;
  border-radius: 6px;
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-row { height: 56px; border-radius: 0; }

/* ===================== CHARTS ===================== */
.chart-wrapper { position: relative; height: 220px; }
.chart-wrapper canvas { max-width: 100%; }

/* ===================== TIMELINE ===================== */
.timeline { padding: 0; list-style: none; }
.timeline-item { display: flex; gap: 16px; padding-bottom: 24px; position: relative; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: 19px; top: 38px;
  width: 2px;
  bottom: 0;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #F1F5F9;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
  position: relative; z-index: 1;
}
.timeline-dot svg { width: 16px; height: 16px; }
.timeline-dot.primary { background: #EFF6FF; border-color: var(--primary); color: var(--primary); }
.timeline-dot.success { background: #F0FDF4; border-color: var(--success); color: var(--success); }
.timeline-content { flex: 1; padding-top: 6px; }
.timeline-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.timeline-time { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.timeline-desc { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ===================== STATUS STEPS ===================== */
.status-steps { display: flex; align-items: center; gap: 0; }
.status-step { display: flex; align-items: center; flex: 1; }
.status-step:last-child { flex: 0; }
.step-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: #F1F5F9;
  color: var(--text-secondary);
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.step-dot.active { background: var(--primary); color: white; border-color: var(--primary); }
.step-dot.done { background: var(--success); color: white; border-color: var(--success); }
.step-dot svg { width: 14px; height: 14px; }
.step-line { flex: 1; height: 2px; background: var(--border); }
.step-line.done { background: var(--success); }
.step-label { font-size: 11px; color: var(--text-secondary); margin-top: 6px; text-align: center; }
.step-wrapper { display: flex; flex-direction: column; align-items: center; }

/* ===================== NOTIFICATIONS DROPDOWN ===================== */
.notif-dropdown {
  position: absolute;
  top: 48px; right: 0;
  width: 360px;
  background: white;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  z-index: 200;
  overflow: hidden;
  animation: fadeIn 0.15s;
}
.notif-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.notif-header h4 { font-size: 14px; font-weight: 700; }
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid #F1F5F9;
  transition: background 0.1s;
  cursor: pointer;
}
.notif-item:hover { background: #F8FAFC; }
.notif-item.unread { background: #EFF6FF; }
.notif-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-icon.blue { background: #DBEAFE; color: var(--primary); }
.notif-icon.red { background: #FEE2E2; color: var(--danger); }
.notif-icon.green { background: #DCFCE7; color: var(--success); }
.notif-icon.yellow { background: #FEF3C7; color: var(--warning); }
.notif-icon svg { width: 16px; height: 16px; }
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.notif-msg { font-size: 12px; color: var(--text-secondary); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time { font-size: 11px; color: #94A3B8; margin-top: 2px; }

/* ===================== CHAT ===================== */
.chat-layout { display: flex; height: calc(100vh - var(--header-height) - 56px); border-radius: var(--radius-card); overflow: hidden; border: 1px solid var(--border); background: white; }
.chat-sidebar { width: 280px; border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.chat-sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); }
.chat-sidebar-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.chat-search { position: relative; }
.chat-search input { width: 100%; padding: 8px 12px 8px 34px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; }
.chat-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-secondary); }
.chat-dealer-list { flex: 1; overflow-y: auto; }
.chat-dealer-item { display: flex; gap: 12px; padding: 12px 16px; cursor: pointer; transition: background 0.1s; border-bottom: 1px solid #F8FAFC; }
.chat-dealer-item:hover { background: #F8FAFC; }
.chat-dealer-item.active { background: #EFF6FF; }
.chat-dealer-avatar { width: 40px; height: 40px; border-radius: 50%; background: #E2E8F0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: var(--primary); flex-shrink: 0; }
.chat-dealer-info { flex: 1; min-width: 0; }
.chat-dealer-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.chat-dealer-preview { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.chat-dealer-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.chat-dealer-time { font-size: 11px; color: var(--text-secondary); }
.chat-dealer-badge { background: var(--primary); color: white; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 10px; }

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.chat-mobile-back { display: none; align-items: center; gap: 3px; color: var(--primary); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.chat-mobile-back svg { width: 18px; height: 18px; }
.chat-header-avatar { width: 38px; height: 38px; border-radius: 50%; background: #E2E8F0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--primary); }
.chat-header-info { flex: 1; }
.chat-header-name { font-size: 15px; font-weight: 700; }
.chat-header-status { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.chat-online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }

.chat-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.msg { display: flex; gap: 8px; max-width: 75%; }
.msg.sent { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 32px; height: 32px; border-radius: 50%; background: #E2E8F0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--primary); flex-shrink: 0; align-self: flex-end; }
.msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  max-width: 100%;
}
.msg.received .msg-bubble { background: #F1F5F9; color: var(--text-primary); border-radius: 14px 14px 14px 4px; }
.msg.sent .msg-bubble { background: var(--primary); color: white; border-radius: 14px 14px 4px 14px; }
.msg-meta { font-size: 11px; margin-top: 4px; opacity: 0.7; text-align: right; display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.msg.received .msg-meta { text-align: left; justify-content: flex-start; }

.chat-input-area { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-end; }
.chat-input-wrap { flex: 1; position: relative; }
.chat-input {
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  outline: none;
  resize: none;
  max-height: 120px;
  transition: border-color 0.15s;
  line-height: 1.5;
}
.chat-input:focus { border-color: var(--primary); }

/* ===================== PROFILE / INFO SECTIONS ===================== */
.info-section { margin-bottom: 24px; }
.info-section-title { font-size: 13px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
.info-item {}
.info-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; margin-bottom: 3px; }
.info-value { font-size: 14px; color: var(--text-primary); font-weight: 500; }

/* ===================== MULTI-STEP FORM ===================== */
.steps-indicator { display: flex; align-items: center; margin-bottom: 32px; }
.step-indicator { display: flex; align-items: center; flex: 1; }
.step-indicator:last-child { flex: 0; }
.step-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  background: #F1F5F9;
  color: var(--text-secondary);
  border: 2px solid var(--border);
  flex-shrink: 0;
  position: relative; z-index: 1;
  transition: all 0.2s;
}
.step-num.active { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,0.15); }
.step-num.completed { background: var(--success); color: white; border-color: var(--success); }
.step-connector { flex: 1; height: 2px; background: var(--border); margin: 0 4px; transition: background 0.3s; }
.step-connector.completed { background: var(--success); }

/* ===================== ANIMATIONS ===================== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideFromRight { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideOut { to { opacity: 0; transform: translateX(24px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes skeleton-loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.page-fade { animation: fadeIn 0.15s ease; }

/* ===================== UTILITIES ===================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-secondary { color: var(--text-secondary); }
.text-primary-color { color: var(--primary); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.relative { position: relative; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }

/* Photo gallery */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.photo-card { border-radius: 10px; overflow: hidden; border: 1px solid var(--border); position: relative; aspect-ratio: 4/3; background: #F1F5F9; cursor: pointer; }
.photo-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s; }
.photo-card:hover img { transform: scale(1.04); }
.photo-label { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(15,23,42,0.7); color: white; font-size: 11px; font-weight: 600; padding: 5px 8px; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1280px) {
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (max-width: 1024px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .logo-text, .sidebar .nav-label, .sidebar .nav-badge, .sidebar .user-info, .sidebar .nav-section-title { opacity: 0; width: 0; overflow: hidden; }
  .sidebar .nav-item { justify-content: center; }
  .main-content { margin-left: var(--sidebar-collapsed); }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-width); transition: transform 0.25s ease; }
  .sidebar .logo-text, .sidebar .nav-label, .sidebar .nav-badge, .sidebar .user-info, .sidebar .nav-section-title { opacity: 1; width: auto; overflow: visible; }
  .sidebar .nav-item { justify-content: flex-start; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 16px; }
  .page-header { flex-direction: column; gap: 12px; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .table-search input { width: 100%; }
  .drawer { width: 100%; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .chat-layout {
    flex-direction: column;
    height: calc(100dvh - var(--header-height) - 112px);
    min-height: 0;
  }
  .chat-layout.no-active-chat .chat-main { display: none; }
  .chat-layout.no-active-chat .chat-sidebar { height: 100%; border-bottom: 0; }
  .chat-layout.has-active-chat .chat-sidebar { display: none; }
  .chat-layout.has-active-chat .chat-main { display: flex; height: 100%; }
  .chat-sidebar {
    width: 100%;
    height: 220px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
  }
  .chat-main { min-height: 0; }
  .chat-page-card {
    height: calc(100dvh - var(--header-height) - 112px) !important;
    min-height: 0;
  }
  .chat-header { padding: 13px 16px; }
  .chat-mobile-back { display: inline-flex; }
  .chat-messages { padding: 14px 12px; }
  .msg { max-width: 88%; }
  .chat-input-area { padding: 10px 12px; gap: 8px; }
  .chat-input { font-size: 16px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .btn { padding: 9px 14px; font-size: 13px; }
  .page-title { font-size: 20px; }
  .chat-sidebar { height: 190px; }
  .chat-layout,
  .chat-page-card { height: calc(100dvh - var(--header-height) - 128px) !important; }
  .chat-sidebar-header { padding: 12px; }
  .chat-dealer-item { padding: 10px 12px; gap: 10px; }
  .chat-input-area .btn-icon { width: 40px; height: 40px; }
}

/* Mobile FAB */
.mobile-fab {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 52px; height: 52px;
  background: var(--primary);
  border-radius: 50%;
  display: none;
  align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(37,99,235,0.4);
  cursor: pointer;
  z-index: 100;
  transition: all 0.2s;
}
.mobile-fab:hover { transform: scale(1.05); box-shadow: 0 6px 20px rgba(37,99,235,0.5); }
.mobile-fab svg { width: 24px; height: 24px; color: white; }
@media (max-width: 768px) { .mobile-fab { display: flex; } }

/* Mobile sidebar overlay */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 99;
  display: none;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s;
  padding: 20px;
}
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 8px; object-fit: contain; }
.lightbox-close {
  position: absolute; top: 20px; right: 20px;
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.1);
  border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: white;
  transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }
.lightbox-close svg { width: 20px; height: 20px; }

/* Dropdown menu */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  z-index: 100;
  overflow: hidden;
  animation: fadeIn 0.12s;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.1s;
  text-decoration: none;
}
.dropdown-item:hover { background: #F8FAFC; text-decoration: none; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: #FEF2F2; }
.dropdown-item svg { width: 16px; height: 16px; }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* Input with icon */
.input-with-icon { position: relative; }
.input-with-icon .input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-secondary); }
.input-with-icon .form-control { padding-left: 36px; }

/* Search highlight */
mark { background: #FEF3C7; color: var(--text-primary); padding: 1px 2px; border-radius: 2px; }
