/* ============================================
   OHRP — O'zbekiston Hududiy Rivojlanish Platformasi
   Dark Mode Premium CSS · 2026
   ============================================ */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2128;
  --bg-card: #21262d;
  --bg-hover: #2d333b;
  --bg-active: #2ea04326;

  --border: #30363d;
  --border-light: #21262d;

  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;

  --accent-blue: #2f80ed;
  --accent-blue-hover: #1f6fd0;
  --accent-green: #2ea043;
  --accent-green-hover: #238636;
  --accent-orange: #f78166;
  --accent-purple: #a371f7;
  --accent-cyan: #79c0ff;
  --accent-yellow: #e3b341;
  --accent-red: #f85149;

  --gradient-primary: linear-gradient(135deg, #2f80ed 0%, #a371f7 100%);
  --gradient-success: linear-gradient(135deg, #2ea043 0%, #79c0ff 100%);
  --gradient-danger: linear-gradient(135deg, #f85149 0%, #f78166 100%);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-xl: 0 16px 64px rgba(0,0,0,0.6);

  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Inter', sans-serif;

  --transition: all 0.2s ease;
  --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============ SIDEBAR ============ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: var(--transition-slow);
  overflow-y: auto;
  overflow-x: hidden;
}

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

.logo-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 4px 16px rgba(47, 128, 237, 0.35);
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
}
.logo-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  line-height: 1.3;
}

.sidebar-close {
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: none;
  transition: var(--transition);
}
.sidebar-close:hover { color: var(--text-primary); background: var(--bg-hover); }

/* NAV */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-group {
  margin-bottom: 20px;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 8px;
  display: block;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  margin-bottom: 1px;
}
.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}
.nav-item span { flex: 1; }
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: rgba(47, 128, 237, 0.15);
  color: var(--accent-cyan);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent-blue);
  border-radius: 0 2px 2px 0;
}

.nav-badge {
  background: var(--gradient-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.nav-pulse {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  position: relative;
}
.nav-pulse::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse 1.5s ease infinite;
}
@keyframes pulse {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

/* SIDEBAR FOOTER */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.sidebar-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.stat-dot.online { background: var(--accent-green); }
.sidebar-version {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ============ OVERLAY ============ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}
.overlay.active { opacity: 1; pointer-events: all; }

/* ============ MAIN WRAPPER ============ */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition-slow);
}

/* ============ TOPBAR ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-height);
  background: rgba(22, 27, 34, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}

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

.menu-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 16px;
  transition: var(--transition);
}
.menu-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.breadcrumb {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.topbar-center {
  flex: 1;
  max-width: 520px;
  margin: 0 auto;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  transition: var(--transition);
}
.search-bar:focus-within {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.15);
}
.search-bar i {
  color: var(--text-muted);
  font-size: 13px;
  flex-shrink: 0;
}
.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar kbd {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.action-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 15px;
  position: relative;
  transition: var(--transition);
}
.action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--accent-orange);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}
.profile-btn:hover { background: var(--bg-hover); border-color: var(--border); }
.profile-avatar {
  width: 32px;
  height: 32px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.profile-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.profile-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.profile-role { font-size: 10px; color: var(--text-muted); }
.profile-btn > i { font-size: 11px; color: var(--text-muted); }

/* ============ CONTENT AREA ============ */
.content-area {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ============ PAGE HEADER ============ */
.page-header {
  margin-bottom: 28px;
}
.page-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(47, 128, 237, 0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(47, 128, 237, 0.4); }
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-success {
  background: var(--gradient-success);
  color: #fff;
}
.btn-danger { background: var(--gradient-danger); color: #fff; }
.btn-ghost { color: var(--text-secondary); padding: 9px 14px; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
}
.card:hover { border-color: var(--border-light); box-shadow: var(--shadow-md); }
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title i { color: var(--accent-blue); }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.stat-card.blue::before { background: var(--gradient-primary); }
.stat-card.green::before { background: var(--gradient-success); }
.stat-card.orange::before { background: linear-gradient(90deg, #f78166, #e3b341); }
.stat-card.purple::before { background: linear-gradient(90deg, #a371f7, #2f80ed); }
.stat-card.red::before { background: var(--gradient-danger); }
.stat-card.cyan::before { background: linear-gradient(90deg, #79c0ff, #2f80ed); }

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.stat-icon.blue { background: rgba(47, 128, 237, 0.15); color: var(--accent-blue); }
.stat-icon.green { background: rgba(46, 160, 67, 0.15); color: var(--accent-green); }
.stat-icon.orange { background: rgba(247, 129, 102, 0.15); color: var(--accent-orange); }
.stat-icon.purple { background: rgba(163, 113, 247, 0.15); color: var(--accent-purple); }
.stat-icon.red { background: rgba(248, 81, 73, 0.15); color: var(--accent-red); }
.stat-icon.cyan { background: rgba(121, 192, 255, 0.15); color: var(--accent-cyan); }

.stat-change {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-change.up { background: rgba(46, 160, 67, 0.15); color: var(--accent-green); }
.stat-change.down { background: rgba(248, 81, 73, 0.15); color: var(--accent-red); }

.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
  font-family: var(--font-mono);
}
.stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}
.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============ GRID LAYOUTS ============ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }

/* ============ CHART WRAPPER ============ */
.chart-wrapper { position: relative; }
.chart-container { height: 280px; position: relative; }
.chart-container-lg { height: 360px; position: relative; }
.chart-container canvas { max-width: 100%; }

/* ============ TABLE ============ */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead tr { border-bottom: 2px solid var(--border); }
thead th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child { border-bottom: none; }
td {
  padding: 12px 14px;
  color: var(--text-secondary);
  vertical-align: middle;
}
td strong { color: var(--text-primary); font-weight: 600; }

/* ============ BADGES ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.badge-blue { background: rgba(47, 128, 237, 0.15); color: var(--accent-blue); }
.badge-green { background: rgba(46, 160, 67, 0.15); color: var(--accent-green); }
.badge-orange { background: rgba(247, 129, 102, 0.15); color: var(--accent-orange); }
.badge-purple { background: rgba(163, 113, 247, 0.15); color: var(--accent-purple); }
.badge-red { background: rgba(248, 81, 73, 0.15); color: var(--accent-red); }
.badge-gray { background: var(--bg-hover); color: var(--text-muted); }

/* ============ PROGRESS ============ */
.progress {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}
.progress-bar.blue { background: var(--gradient-primary); }
.progress-bar.green { background: var(--gradient-success); }
.progress-bar.orange { background: linear-gradient(90deg, #f78166, #e3b341); }
.progress-bar.purple { background: linear-gradient(90deg, #a371f7, #2f80ed); }
.progress-bar.red { background: var(--gradient-danger); }

/* ============ FORM CONTROLS ============ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 7px;
}
.form-label .req { color: var(--accent-red); margin-left: 2px; }

.form-control, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.15);
}
.form-control::placeholder { color: var(--text-muted); }
.form-select { appearance: none; cursor: pointer; }
.form-select option { background: var(--bg-card); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--accent-red); margin-top: 5px; display: none; }
.form-control.error { border-color: var(--accent-red); }
.form-control.error + .form-error { display: block; }

textarea.form-control { resize: vertical; min-height: 100px; }

/* ============ RANGE INPUT ============ */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-blue);
  border: 2px solid var(--bg-card);
  box-shadow: 0 2px 6px rgba(47, 128, 237, 0.4);
}

/* ============ TABS ============ */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  overflow-x: auto;
  margin-bottom: 20px;
}
.tab-btn {
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent-cyan); border-bottom-color: var(--accent-blue); }

/* ============ ALERTS ============ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid;
  margin-bottom: 16px;
  font-size: 13.5px;
}
.alert i { margin-top: 1px; flex-shrink: 0; }
.alert.info { background: rgba(47, 128, 237, 0.1); border-color: rgba(47, 128, 237, 0.3); color: var(--accent-cyan); }
.alert.success { background: rgba(46, 160, 67, 0.1); border-color: rgba(46, 160, 67, 0.3); color: var(--accent-green); }
.alert.warning { background: rgba(227, 179, 65, 0.1); border-color: rgba(227, 179, 65, 0.3); color: var(--accent-yellow); }
.alert.danger { background: rgba(248, 81, 73, 0.1); border-color: rgba(248, 81, 73, 0.3); color: var(--accent-red); }

/* ============ LOADING SPINNER ============ */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ SKELETON ============ */
.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);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============ MODAL ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}
.modal-backdrop.show { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: var(--transition);
  box-shadow: var(--shadow-xl);
}
.modal-backdrop.show .modal { transform: translateY(0); }
.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 { color: var(--text-muted); font-size: 18px; transition: var(--transition); }
.modal-close:hover { color: var(--text-primary); }
.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;
}

/* ============ TAG / CHIP ============ */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  gap: 6px;
}
.tag:hover { border-color: var(--accent-blue); color: var(--accent-cyan); }

/* ============ AI CHAT WIDGET ============ */
.ai-chat-widget {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 380px;
  max-height: 560px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  z-index: 500;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.ai-chat-widget.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}
.ai-chat-widget.expanded {
  width: 560px;
  max-height: 80vh;
  bottom: 90px;
  right: 24px;
}

.chat-header {
  background: linear-gradient(135deg, #0d1117, #161b22);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chat-ai-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-avatar-small {
  position: relative;
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
}
.ai-online-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 9px; height: 9px;
  background: var(--accent-green);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}
.chat-ai-name { display: block; font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.chat-ai-status { display: block; font-size: 11px; color: var(--accent-green); }

.chat-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-expand, .chat-close-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  transition: var(--transition);
}
.chat-expand:hover, .chat-close-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

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

.chat-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.chat-msg.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  background: var(--gradient-primary);
  color: #fff;
}
.chat-msg.user .msg-avatar { background: var(--bg-hover); color: var(--text-secondary); }

.msg-content {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  border-top-left-radius: 4px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.msg-content p { margin-bottom: 6px; }
.msg-content p:last-child { margin-bottom: 0; }
.chat-msg.user .msg-content {
  background: rgba(47, 128, 237, 0.15);
  border-color: rgba(47, 128, 237, 0.3);
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: 4px;
  color: var(--text-primary);
}

.msg-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 4px 0;
}
.msg-typing span {
  width: 6px; height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.2s infinite;
}
.msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.msg-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.chip {
  padding: 5px 11px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.chip:hover { border-color: var(--accent-blue); color: var(--accent-cyan); background: rgba(47, 128, 237, 0.1); }

.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  flex-shrink: 0;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  resize: none;
  outline: none;
  max-height: 120px;
  transition: var(--transition);
  line-height: 1.5;
}
.chat-input:focus { border-color: var(--accent-blue); }
.chat-input::placeholder { color: var(--text-muted); }
.chat-send {
  width: 38px; height: 38px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  transition: var(--transition);
  flex-shrink: 0;
}
.chat-send:hover { transform: scale(1.05); box-shadow: 0 4px 14px rgba(47, 128, 237, 0.4); }
.chat-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

/* ============ AI CHAT TOGGLE ============ */
.ai-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gradient-primary);
  color: #fff;
  padding: 10px 18px 10px 12px;
  border-radius: 28px;
  box-shadow: 0 6px 24px rgba(47, 128, 237, 0.4);
  z-index: 499;
  font-size: 13.5px;
  font-weight: 700;
  transition: var(--transition);
}
.ai-chat-toggle:hover { transform: translateY(-2px); box-shadow: 0 10px 32px rgba(47, 128, 237, 0.5); }
.toggle-icon { position: relative; font-size: 18px; }
.toggle-badge {
  position: absolute;
  top: -6px; right: -10px;
  background: var(--accent-green);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}
.toggle-label { letter-spacing: 0.2px; }

/* ============ PROFILE DROPDOWN ============ */
.profile-dropdown {
  position: fixed;
  top: 68px;
  right: 20px;
  width: 240px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 400;
  overflow: hidden;
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}
.profile-dropdown.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}
.dropdown-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
}
.dropdown-avatar {
  width: 38px; height: 38px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.dropdown-name { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.dropdown-email { font-size: 11px; color: var(--text-muted); }
.dropdown-divider { height: 1px; background: var(--border); }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13.5px;
  color: var(--text-secondary);
  transition: var(--transition);
}
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item i { width: 16px; text-align: center; }
.dropdown-item.danger:hover { background: rgba(248, 81, 73, 0.1); color: var(--accent-red); }

/* ============ REGION ITEMS ============ */
.region-list { display: flex; flex-direction: column; gap: 8px; }
.region-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
}
.region-item:hover { border-color: var(--accent-blue); background: rgba(47, 128, 237, 0.05); }
.region-rank {
  width: 24px;
  height: 24px;
  background: var(--bg-hover);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}
.region-rank.top3 { background: rgba(227, 179, 65, 0.2); color: var(--accent-yellow); }
.region-name { flex: 1; font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.region-pop { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }
.region-bar-wrap { width: 80px; }

/* ============ PROBLEM CARD ============ */
.problem-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.problem-card:hover { transform: translateX(3px); box-shadow: var(--shadow-sm); }
.problem-card.high { border-left-color: var(--accent-red); }
.problem-card.medium { border-left-color: var(--accent-yellow); }
.problem-card.low { border-left-color: var(--accent-green); }
.problem-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.problem-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.problem-region { font-size: 11.5px; color: var(--text-muted); margin-bottom: 8px; display: flex; align-items: center; gap: 5px; }
.problem-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 10px; }
.problem-solution {
  background: rgba(46, 160, 67, 0.08);
  border: 1px solid rgba(46, 160, 67, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.problem-solution strong { color: var(--accent-green); }

/* ============ JOB CARD ============ */
.job-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: var(--transition);
}
.job-card:hover { border-color: var(--accent-blue); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.job-header { display: flex; gap: 12px; margin-bottom: 12px; }
.job-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}
.job-title { font-size: 14.5px; font-weight: 700; color: var(--text-primary); }
.job-company { font-size: 12px; color: var(--text-muted); }
.job-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.job-footer { display: flex; align-items: center; justify-content: space-between; }
.job-salary { font-size: 14px; font-weight: 700; color: var(--accent-green); font-family: var(--font-mono); }
.job-location { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

/* ============ MAP GRID ============ */
.regions-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.map-region-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.map-region-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(47, 128, 237, 0.2);
}
.map-region-card.selected {
  border-color: var(--accent-blue);
  background: rgba(47, 128, 237, 0.1);
}
.map-region-icon { font-size: 28px; margin-bottom: 8px; }
.map-region-name { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.map-region-pop { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.map-region-score {
  margin-top: 10px;
  font-size: 20px;
  font-weight: 800;
  font-family: var(--font-mono);
}
.map-region-score.good { color: var(--accent-green); }
.map-region-score.medium { color: var(--accent-yellow); }
.map-region-score.poor { color: var(--accent-red); }

/* ============ TOAST NOTIFICATIONS ============ */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  min-width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease forwards;
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast-icon { font-size: 16px; margin-top: 1px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--accent-green); }
.toast.error .toast-icon { color: var(--accent-red); }
.toast.info .toast-icon { color: var(--accent-blue); }
.toast-text { flex: 1; font-size: 13px; line-height: 1.5; color: var(--text-primary); }
.toast-close { color: var(--text-muted); font-size: 13px; }

/* ============ AI ANALYSIS BOX ============ */
.ai-result-box {
  background: linear-gradient(135deg, rgba(47,128,237,0.08), rgba(163,113,247,0.08));
  border: 1px solid rgba(47, 128, 237, 0.25);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 16px;
}
.ai-result-box .ai-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-cyan);
}
.ai-result-box .ai-body {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.8;
}
.ai-result-box .ai-section {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.ai-result-box .ai-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.ai-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-purple);
  margin-bottom: 6px;
}
.ai-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.ai-item i { color: var(--accent-blue); margin-top: 2px; flex-shrink: 0; }

/* ============ STEPS ============ */
.steps { display: flex; flex-direction: column; gap: 0; }
.step {
  display: flex;
  gap: 14px;
  padding-bottom: 20px;
  position: relative;
}
.step:last-child { padding-bottom: 0; }
.step::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 36px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.step:last-child::before { display: none; }
.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.step-num.done { background: rgba(46, 160, 67, 0.2); color: var(--accent-green); }
.step-num.active { background: rgba(47, 128, 237, 0.2); color: var(--accent-blue); }
.step-num.pending { background: var(--bg-hover); color: var(--text-muted); }
.step-content { flex: 1; padding-top: 6px; }
.step-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.step-desc { font-size: 13px; color: var(--text-secondary); }

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ============ SEARCH RESULTS ============ */
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  max-height: 320px;
  overflow-y: auto;
}
.search-result-item {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border-light);
}
.search-result-item:hover { background: var(--bg-hover); }
.search-result-item:last-child { border-bottom: none; }

/* ============ ANALYSIS OPTION ============ */
.analysis-option-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
}
.analysis-option-label:hover { border-color: var(--accent-blue); }
.analysis-option-label input { accent-color: var(--accent-blue); }

/* ============ UTILITY ============ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

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

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title i { color: var(--accent-blue); }

/* ============ ANIMATIONS ============ */
.fade-in {
  animation: fadeIn 0.4s ease forwards;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.slide-up {
  animation: slideUp 0.3s ease forwards;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Staggered children animation */
.stagger > * {
  opacity: 0;
  animation: fadeIn 0.4s ease forwards;
}
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }
.stagger > *:nth-child(7) { animation-delay: 0.35s; }
.stagger > *:nth-child(8) { animation-delay: 0.4s; }
.stagger > *:nth-child(n+9) { animation-delay: 0.45s; }

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

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    width: 260px;
    z-index: 300;
  }
  .sidebar-close { display: flex; }

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

  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-center { display: none; }
  .profile-info { display: none; }
  .profile-btn { padding: 6px; gap: 0; }

  .content-area { padding: 14px; }

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

  .ai-chat-widget {
    width: calc(100vw - 16px);
    right: 8px;
    bottom: 80px;
  }
  .ai-chat-widget.expanded {
    width: calc(100vw - 16px);
    right: 8px;
  }

  .ai-chat-toggle {
    bottom: 16px;
    right: 16px;
  }
  .toggle-label { display: none; }
  .ai-chat-toggle { border-radius: 50%; width: 54px; height: 54px; padding: 0; justify-content: center; }

  .page-title { font-size: 20px; }
  .page-header-top { flex-direction: column; }

  .profile-dropdown { right: 8px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  .regions-map-grid { grid-template-columns: repeat(2, 1fr); }
}
