/* ============================================================
   ProfitEngine v5 — Design System CSS
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
/* Imported in index.html to avoid @import render blocking, but fallback defined here */

/* ── CSS Custom Properties (Design Tokens) ─────────────────── */
:root {
  /* Colors - Premium Obsidian & Amethyst */
  --primary:       #9d4edd; /* Electric Amethyst */
  --primary-dark:  #7b2cbf;
  --primary-light: #c77dff;
  --secondary:     #00f5d4; /* Cyan Glow */
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #3b82f6;

  /* Backgrounds */
  --bg-base:    #050505; /* Deep Obsidian */
  --bg-surface: #0a0a0a;
  --bg-card:    rgba(255, 255, 255, 0.02); /* Frosted Glass */
  --bg-hover:   rgba(255, 255, 255, 0.05);
  --bg-input:   rgba(255, 255, 255, 0.03);

  /* Borders */
  --border:       rgba(255, 255, 255, 0.08);
  --border-focus: rgba(157, 78, 221, 0.5);

  /* Text */
  --text-primary:   #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted:     #64748b;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #9d4edd 0%, #7b2cbf 100%);
  --gradient-card:    linear-gradient(145deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);

  /* Sizing */
  --sidebar-width: 260px;
  --header-height: 72px;
  --radius:        16px;
  --radius-sm:     8px;
  --radius-lg:     24px;

  /* Shadows & Glows */
  --shadow-sm:  0 4px 12px rgba(0,0,0,0.4);
  --shadow-md:  0 12px 32px rgba(0,0,0,0.5);
  --shadow-lg:  0 24px 64px rgba(0,0,0,0.6);
  --glow:       0 0 24px rgba(157, 78, 221, 0.25);
  --glow-hover: 0 0 40px rgba(157, 78, 221, 0.4);

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary); }
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

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

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: transparent;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
  padding: 16px 0 16px 16px; /* Floating pill effect */
}
.sidebar::before {
  content: '';
  position: absolute;
  top: 16px; left: 16px; right: 0; bottom: 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), var(--shadow-sm);
  z-index: -1;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0; z-index: 90;
  backdrop-filter: blur(12px);
}

.page-content {
  flex: 1;
  padding: 24px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* ── Sidebar Components ─────────────────────────────────────── */
.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.sidebar-logo .logo-icon {
  width: 120px;
  object-fit: contain;
}
.sidebar-logo .logo-text { display: none; }

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-section { padding: 0 12px 8px; }
.nav-section-title {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted); padding: 8px 12px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer;
  transition: var(--transition); font-size: 14px; font-weight: 500;
  text-decoration: none; margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: rgba(99,102,241,0.15); color: var(--primary-light);
  box-shadow: inset 3px 0 0 var(--primary);
}
.nav-item .nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--danger);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 10px; min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--border);
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius);
  cursor: pointer; transition: var(--transition);
}
.user-card:hover { background: var(--bg-hover); }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gradient-primary); display: flex;
  align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
  flex-shrink: 0; overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info .user-name { font-size: 13px; font-weight: 600; }
.user-info .user-role { font-size: 11px; color: var(--text-muted); }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02), var(--shadow-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition);
}
.card:hover { border-color: rgba(157,78,221,0.2); box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), var(--shadow-md); transform: translateY(-1px); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.card-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }

/* KPI Card */
.kpi-card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), var(--shadow-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition);
}
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px; background: var(--gradient-primary);
  opacity: 0.8;
}
.kpi-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg), var(--glow); border-color: rgba(157,78,221,0.3); }
.kpi-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.kpi-value { font-size: 32px; font-weight: 800; line-height: 1; }
.kpi-value.text-primary { color: var(--primary-light); }
.kpi-value.text-success { color: var(--success); }
.kpi-value.text-warning { color: var(--warning); }
.kpi-value.text-danger  { color: var(--danger); }
.kpi-footer { margin-top: 8px; font-size: 12px; color: var(--text-muted); }

/* ── Grid System ────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  transition: var(--transition); white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--gradient-primary); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), var(--shadow-sm), var(--glow);
  border-color: rgba(255,255,255,0.1);
}
.btn-primary:hover:not(:disabled) { box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), var(--shadow-md), var(--glow-hover); filter: brightness(1.15); transform: translateY(-1px); }
.btn-secondary { background: rgba(255,255,255,0.03); color: var(--text-primary); border: 1px solid var(--border); box-shadow: inset 0 1px 0 rgba(255,255,255,0.02); }
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); transform: translateY(-1px); }
.btn-danger { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.2); color: #fff; border-color: var(--danger); box-shadow: 0 0 16px rgba(239,68,68,0.2); transform: translateY(-1px); }
.btn-success { background: rgba(16,185,129,0.1); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.btn-success:hover:not(:disabled) { background: var(--success); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-icon { padding: 8px; }
.btn-icon svg { width: 18px; height: 18px; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-primary { background: rgba(99,102,241,0.2); color: var(--primary-light); }
.badge-success { background: rgba(16,185,129,0.2); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.2); color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,0.2); color: var(--danger); }
.badge-info    { background: rgba(59,130,246,0.2); color: var(--info); }
.badge-muted   { background: rgba(100,116,139,0.2); color: var(--text-secondary); }

/* Priority badges */
.priority-Critical { background: rgba(239,68,68,0.2); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.priority-High     { background: rgba(245,158,11,0.2); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.priority-Medium   { background: rgba(99,102,241,0.2); color: #818cf8; border: 1px solid rgba(99,102,241,0.3); }
.priority-Low      { background: rgba(16,185,129,0.2); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); letter-spacing: -0.01em; }
.form-control {
  width: 100%; padding: 12px 16px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 14px; transition: var(--transition);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(157, 78, 221, 0.15), inset 0 1px 2px rgba(0,0,0,0.1); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' 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; background-size: 16px; padding-right: 40px; }
select.form-control option { background: var(--bg-surface); color: var(--text-primary); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { min-height: 100px; resize: vertical; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-help  { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Table ──────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-card); box-shadow: inset 0 1px 0 rgba(255,255,255,0.02); }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead th {
  background: rgba(255,255,255,0.02); padding: 16px 20px;
  text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 14px; font-weight: 500; }
tbody tr { transition: var(--transition); position: relative; }
tbody tr:hover { background: var(--bg-hover); box-shadow: inset 2px 0 0 var(--primary); }
tbody tr:last-child td { border-bottom: none; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-height: 90vh;
  overflow-y: auto; animation: slideUp 0.2s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), var(--shadow-lg);
}
.modal-sm  { max-width: 420px; }
.modal-md  { max-width: 600px; }
.modal-lg  { max-width: 900px; }
.modal-xl  { max-width: 1200px; }
.modal-header {
  padding: 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--bg-surface); z-index: 1;
}
.modal-title { font-size: 18px; font-weight: 700; }
.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;
}

/* ── Toast Notifications ────────────────────────────────────── */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 12px; max-width: 360px;
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), var(--shadow-md); animation: slideIn 0.3s ease;
  font-size: 14px; font-weight: 500;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info    { border-left: 3px solid var(--info); }
.toast-icon svg { width: 20px; height: 20px; flex-shrink: 0; }
.toast.success .toast-icon svg { color: var(--success); }
.toast.error   .toast-icon svg { color: var(--danger); }
.toast.warning .toast-icon svg { color: var(--warning); }
.toast.info    .toast-icon svg { color: var(--info); }
.toast-message { flex: 1; font-weight: 500; line-height: 1.5; }
.toast-close { cursor: pointer; color: var(--text-muted); margin-left: auto; }

/* ── Loading States ─────────────────────────────────────────── */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; }
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ── Ticket Status Dot ──────────────────────────────────────── */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  display: inline-block;
}

/* ── Avatar Group ───────────────────────────────────────────── */
.avatar-group { display: flex; }
.avatar-group .user-avatar { margin-left: -8px; border: 2px solid var(--bg-card); }
.avatar-group .user-avatar:first-child { margin-left: 0; }

/* ── Search Bar ─────────────────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px; flex: 1; max-width: 400px;
  transition: var(--transition);
}
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.search-bar input { background: none; border: none; outline: none; color: var(--text-primary); font-size: 14px; width: 100%; }
.search-bar svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 20px;
}
.page-btn {
  min-width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer; font-size: 13px;
  transition: var(--transition);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary-light); }
.page-btn.active { background: var(--gradient-primary); color: #fff; border-color: transparent; box-shadow: var(--glow); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state svg { width: 64px; height: 64px; margin: 0 auto 16px; opacity: 0.3; }
.empty-state h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { font-size: 14px; max-width: 300px; margin: 0 auto 20px; }

/* ── Progress Bar ───────────────────────────────────────────── */
.progress-bar { background: var(--bg-hover); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--gradient-primary); transition: width 0.5s ease; }
.progress-fill.warning { background: linear-gradient(90deg, var(--warning), #f97316); }
.progress-fill.danger  { background: linear-gradient(90deg, var(--danger), #dc2626); }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 16px; font-size: 14px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent; transition: var(--transition); margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--primary-light); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Dropdown ───────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 4px); right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 180px; z-index: 200;
  box-shadow: var(--shadow-md); overflow: hidden;
  animation: fadeIn 0.15s ease;
}
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; font-size: 13px; color: var(--text-secondary);
  cursor: pointer; transition: var(--transition);
}
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: rgba(239,68,68,0.1); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Utility Classes ────────────────────────────────────────── */
.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.text-sm   { font-size: 12px; }
.text-base { font-size: 14px; }
.text-lg   { font-size: 16px; }
.text-xl   { font-size: 20px; }
.text-2xl  { font-size: 24px; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.text-muted    { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary  { color: var(--primary-light); }
.text-success  { color: var(--success); }
.text-warning  { color: var(--warning); }
.text-danger   { color: var(--danger); }
.mb-4   { margin-bottom: 4px; }
.mb-8   { margin-bottom: 8px; }
.mb-12  { margin-bottom: 12px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.p-0    { padding: 0; }
.overflow-hidden { overflow: hidden; }
.rounded        { border-radius: var(--radius); }
.rounded-full   { border-radius: 50%; }
.truncate       { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden         { display: none !important; }
.sr-only        { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.cursor-pointer { cursor: pointer; }
.select-none    { user-select: none; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes shimmer  { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes pulse    { 0%,100%{ opacity:1; } 50%{ opacity:0.5; } }
@keyframes bounce   { 0%,100%{ transform:translateY(0); } 50%{ transform:translateY(-4px); } }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-260px); }
  .sidebar.open { transform: translateX(0); --sidebar-width: 260px; }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

/* ── Login Page ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-base); padding: 20px;
  background-image: radial-gradient(circle at 20% 80%, rgba(99,102,241,0.1) 0%, transparent 50%),
                    radial-gradient(circle at 80% 20%, rgba(139,92,246,0.1) 0%, transparent 50%);
}
.login-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg), var(--glow);
  animation: slideUp 0.4s ease;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-icon {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--gradient-primary); margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow); font-size: 24px;
}
.login-logo h1 { font-size: 22px; font-weight: 800; }
.login-logo p  { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ── Ticket Detail ──────────────────────────────────────────── */
.ticket-detail-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
.ticket-hierarchy-tree { border-left: 2px solid var(--border); margin-left: 8px; }
.ticket-hierarchy-tree .tree-node {
  position: relative; padding: 4px 0 4px 20px;
}
.ticket-hierarchy-tree .tree-node::before {
  content: ''; position: absolute; left: 0; top: 14px;
  width: 16px; height: 1px; background: var(--border);
}

/* ── Chat ───────────────────────────────────────────────────── */
.chat-layout { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - var(--header-height) - 48px); gap: 16px; }
.chat-sidebar { display: flex; flex-direction: column; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.conversation-list { flex: 1; overflow-y: auto; }
.conversation-item { padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: var(--transition); }
.conversation-item:hover { background: var(--bg-hover); }
.conversation-item.active { background: rgba(99,102,241,0.1); border-right: 2px solid var(--primary); }
.chat-main { display: flex; flex-direction: column; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.chat-message { display: flex; gap: 10px; max-width: 75%; }
.chat-message.own { align-self: flex-end; flex-direction: row-reverse; }
.message-bubble {
  padding: 10px 14px; border-radius: 14px; font-size: 14px;
  background: var(--bg-surface); word-break: break-word;
}
.chat-message.own .message-bubble { background: var(--gradient-primary); }
.chat-input-area { padding: 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.chat-input {
  flex: 1; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px; color: var(--text-primary);
  font-size: 14px; resize: none; min-height: 42px; max-height: 120px; overflow-y: auto;
}
.chat-input:focus { outline: none; border-color: var(--primary); }

/* ── Drag & Drop (Kanban) ───────────────────────────────────── */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; }
.kanban-column {
  min-width: 280px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 200px);
}
.kanban-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.kanban-header .status-dot { width: 10px; height: 10px; }
.kanban-cards { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.kanban-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; cursor: grab;
  transition: var(--transition);
}
.kanban-card:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.kanban-card.dragging { opacity: 0.5; cursor: grabbing; }
.kanban-column.drag-over { border-color: var(--primary); background: rgba(99,102,241,0.05); }

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg-card, #1E1B4B);
  border: 1px solid var(--border, #312E81);
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: modal-enter 0.2s ease-out;
  display: flex;
  flex-direction: column;
}
@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border, #312E81);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}
.close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}
.close-btn:hover {
  color: white;
}
.modal-body {
  padding: 24px;
  max-height: 80vh;
  overflow-y: auto;
}

/* Fix for .form-input text visibility */
.form-input {
  color: var(--text-primary) !important;
}
