@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg-body: #060910;
  --bg-sidebar: #0b1018;
  --bg-main: #0a0e17;
  --bg-card: #111827;
  --bg-card-hover: #151c2c;
  --bg-elevated: #1a2236;
  --bg-input: #0d1220;
  --border: #1e2a3e;
  --border-light: #253046;
  --text-primary: #eef1f6;
  --text-secondary: #8896ab;
  --text-muted: #4e5c72;
  --accent: #4f8fff;
  --accent-hover: #3a7bf0;
  --accent-glow: rgba(79, 143, 255, .15);
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, .1);
  --green-border: rgba(52, 211, 153, .25);
  --purple: #a78bfa;
  --purple-bg: rgba(167, 139, 250, .1);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, .1);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, .1);
  --red-border: rgba(248, 113, 113, .25);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --sidebar-width: 220px;
  --transition: .2s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 13px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(79,143,255,.08) 0%, transparent 70%);
  top: -200px; right: -100px;
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(167,139,250,.06) 0%, transparent 70%);
  bottom: -150px; left: -100px;
  pointer-events: none;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 80px rgba(79,143,255,.04);
}
.login-logo {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px;
  font-size: 20px; font-weight: 800; color: #fff;
}
.login-card h1 { font-size: 26px; font-weight: 800; margin-bottom: 6px; letter-spacing: -.3px; }
.login-card .sub { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }
.login-card input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: border var(--transition), box-shadow var(--transition);
  margin-bottom: 16px;
}
.login-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.login-card button {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.login-card button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(79,143,255,.25);
}
.login-error {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
  padding: 12px 14px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  margin-bottom: 16px;
}

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

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s ease;
}
.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.sidebar-brand { font-size: 15px; font-weight: 800; letter-spacing: -.3px; }
.sidebar-brand small { display: block; font-size: 10px; font-weight: 500; color: var(--text-muted); letter-spacing: 0; margin-top: 1px; }

.sidebar-nav { padding: 8px 12px; flex: 1; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
}
.sidebar-nav a:hover { color: var(--text-primary); background: var(--bg-elevated); }
.sidebar-nav a.active {
  color: var(--accent);
  background: var(--accent-glow);
}
.sidebar-nav a svg { width: 20px; height: 20px; opacity: .7; flex-shrink: 0; }
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-section {
  padding: 16px 14px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-left: 12px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}
.sidebar-footer a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px; font-weight: 500;
  transition: all var(--transition);
}
.sidebar-footer a:hover { color: var(--red); background: var(--red-bg); }
.sidebar-footer a svg { width: 18px; height: 18px; }

/* ===== MAIN CONTENT ===== */
.main { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; padding: 24px; }

.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.page-header p { color: var(--text-muted); font-size: 12px; margin-top: 3px; }

/* ===== STAT CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-1px); }

.stat-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.stat-icon svg { width: 16px; height: 16px; }
.stat-icon.blue { background: var(--accent-glow); color: var(--accent); }
.stat-icon.green { background: var(--green-bg); color: var(--green); }
.stat-icon.purple { background: var(--purple-bg); color: var(--purple); }
.stat-icon.amber { background: var(--amber-bg); color: var(--amber); }

.stat-label { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 800; letter-spacing: -.5px; line-height: 1; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.stat-sub span { font-weight: 600; }
.stat-sub .up { color: var(--green); }
.stat-sub .down { color: var(--red); }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 13px; font-weight: 700; }
.card-body { padding: 18px; }
.card-body.no-pad { padding: 0; }

/* ===== GRID ===== */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-23 { grid-template-columns: 2fr 1fr; }

/* ===== TABLES ===== */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  position: sticky; top: 0;
  z-index: 2;
}
tbody td {
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid rgba(30,42,62,.5);
  transition: background var(--transition);
}
tbody tr { transition: background var(--transition); }
tbody tr:hover td { background: var(--bg-card-hover); }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge-green { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.badge-green::before { background: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.badge-red::before { background: var(--red); }
.badge-blue { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(79,143,255,.25); }
.badge-blue::before { background: var(--accent); }
.badge-amber { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(251,191,36,.25); }
.badge-amber::before { background: var(--amber); }
.badge-gray { background: rgba(78,92,114,.15); color: var(--text-muted); border: 1px solid rgba(78,92,114,.25); }
.badge-gray::before { background: var(--text-muted); }

/* ===== SEARCH ===== */
.toolbar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.toolbar .search-input {
  flex: 1; min-width: 240px;
  position: relative;
}
.toolbar .search-input svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-muted); pointer-events: none;
}
.toolbar .search-input input {
  width: 100%;
  padding: 11px 14px 11px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border var(--transition), box-shadow var(--transition);
}
.toolbar .search-input input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.toolbar select {
  padding: 11px 36px 11px 14px;
  background: var(--bg-input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234e5c72' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border var(--transition);
  min-width: 160px;
}
.toolbar select:focus { border-color: var(--accent); }

/* ===== PAGINATION ===== */
.pagination {
  display: flex; gap: 8px; justify-content: center; align-items: center;
  margin-top: 20px; padding: 16px 0;
}
.pagination button {
  padding: 8px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.pagination button:hover:not(:disabled) { background: var(--bg-elevated); color: var(--text-primary); }
.pagination button:disabled { opacity: .3; cursor: default; }
.pagination span { color: var(--text-muted); font-size: 13px; padding: 0 8px; }

/* ===== CLIENT DETAIL ===== */
.client-hero {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.client-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--purple), var(--green));
}
.client-back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  margin-bottom: 16px;
  transition: color var(--transition);
}
.client-back:hover { color: var(--text-primary); }
.client-back svg { width: 16px; height: 16px; }
.client-name-row { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.client-avatar {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.client-name-row h1 { font-size: 24px; font-weight: 800; letter-spacing: -.3px; }
.client-name-row .meta { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.client-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.info-item {
  padding: 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}
.info-item .label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px; }
.info-item .val { font-size: 14px; font-weight: 600; }

/* ===== COMMENT BOX ===== */
.comment-box {
  background: linear-gradient(135deg, rgba(79,143,255,.06), rgba(167,139,250,.04));
  border: 1px solid rgba(79,143,255,.15);
  border-radius: var(--radius);
  padding: 20px;
  white-space: pre-line;
  line-height: 1.8;
  font-size: 14px;
  color: var(--text-secondary);
  position: relative;
}
.comment-box::before {
  content: '💬';
  position: absolute;
  top: 14px; right: 16px;
  font-size: 18px;
  opacity: .4;
}

/* ===== TABS ===== */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  background: none;
  border-top: none; border-left: none; border-right: none;
  font-family: inherit;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .3s ease; }

/* ===== TIMELINE ===== */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 8px; top: 4px; bottom: 4px;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  padding: 10px 0;
  font-size: 14px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px; top: 16px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent);
}
.timeline-date { color: var(--text-muted); font-size: 12px; font-weight: 600; }
.timeline-text { color: var(--text-secondary); margin-top: 2px; }

/* ===== PROGRESS BAR ===== */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  width: 100%;
}
.progress-bar .fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width .6s ease;
}

/* ===== CHART CONTAINER ===== */
.chart-container { position: relative; height: 220px; }

/* ===== STATUS LIST ===== */
.status-list { list-style: none; }
.status-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  font-size: 14px;
  border-bottom: 1px solid rgba(30,42,62,.4);
}
.status-list li:last-child { border-bottom: none; }
.status-list .status-name { display: flex; align-items: center; gap: 8px; }
.status-list .status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-list .status-count { color: var(--text-muted); font-weight: 600; }

/* ===== SECTION ===== */
.section { margin-top: 28px; }
.section h2 { font-size: 17px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.section h2 .count { font-size: 13px; color: var(--text-muted); font-weight: 500; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: .3; }
.empty-state p { font-size: 14px; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }

.animate-in { animation: fadeIn .4s ease both; }
.stagger-1 { animation-delay: .05s; }
.stagger-2 { animation-delay: .1s; }
.stagger-3 { animation-delay: .15s; }
.stagger-4 { animation-delay: .2s; }

/* ===== MOBILE ===== */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 200;
  width: 40px; height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
}
.mobile-toggle svg { width: 20px; height: 20px; }
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99;
}

@media (max-width: 1400px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .grid-23 { grid-template-columns: 1.5fr 1fr; }
}

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .grid-23 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1024px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .sidebar { --sidebar-width: 200px; width: var(--sidebar-width); }
  .main { padding: 20px; }
}

@media (max-width: 768px) {
  .mobile-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); width: 260px; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main { margin-left: 0; padding: 16px; padding-top: 64px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 20px; }
  .client-hero { padding: 20px; }
  .client-info-grid { grid-template-columns: 1fr 1fr; }
  .client-name-row h1 { font-size: 18px; }
  .toolbar { flex-direction: column; }
  .toolbar .search-input { min-width: 100%; }
  .toolbar select { width: 100%; }
  .tabs { overflow-x: auto; white-space: nowrap; }
  .tab { padding: 10px 14px; font-size: 13px; }
  thead th { padding: 10px 12px; font-size: 10px; }
  tbody td { padding: 10px 12px; font-size: 13px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .client-info-grid { grid-template-columns: 1fr; }
  .client-avatar { width: 44px; height: 44px; font-size: 18px; border-radius: 12px; }
}
