/* ============================================================
   Raqamli Komplayens — Och ko'k va och yashil tema
   ============================================================ */

:root {
  --blue-50:  #f0f9ff;
  --blue-100: #e0f2fe;
  --blue-200: #bae6fd;
  --blue-300: #7dd3fc;
  --blue-400: #38bdf8;
  --blue-500: #0ea5e9;
  --blue-600: #0284c7;
  --blue-700: #0369a1;
  --blue-800: #075985;

  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;

  --teal-700: #0f766e;
  --teal-800: #115e59;

  --orange:        #f59e0b;
  --orange-dark:   #d97706;
  --orange-bg:     #fffbeb;
  --orange-border: #fde68a;

  --red:        #ef4444;
  --red-dark:   #dc2626;
  --red-bg:     #fef2f2;
  --red-border: #fecaca;

  --purple:    #8b5cf6;
  --purple-bg: #f5f3ff;

  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  --sidebar-w: 260px;
  --header-h:  64px;
  --radius:    10px;
  --radius-lg: 14px;
  --shadow:    0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,.12), 0 4px 6px rgba(0,0,0,.07);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--blue-50);
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-600); text-decoration: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
table { border-collapse: collapse; width: 100%; }
.hidden { display: none !important; }

/* ── Login ──────────────────────────────────────────────────── */
#loginPage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue-700) 0%, var(--teal-700) 50%, var(--green-700) 100%);
  padding: 24px;
}
.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}
.login-logo-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--blue-600), var(--green-600));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.login-logo-text h1 { font-size: 20px; font-weight: 800; color: var(--gray-900); }
.login-logo-text p  { font-size: 12px; color: var(--gray-500); }
.login-subtitle {
  font-size: 13px; color: var(--gray-500);
  margin-bottom: 24px;
  padding: 12px 14px;
  background: var(--blue-50);
  border-radius: 8px;
  border-left: 3px solid var(--blue-400);
  line-height: 1.7;
}
.login-subtitle span { font-weight: 600; color: var(--blue-700); }

.role-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
.role-card {
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
}
.role-card:hover  { border-color: var(--blue-400); background: var(--blue-50); color: var(--blue-700); }
.role-card.active { border-color: var(--blue-600); background: var(--blue-100); color: var(--blue-700); font-weight: 700; }
.role-card-icon { font-size: 18px; }

/* ── Layout ─────────────────────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(160deg, var(--blue-800) 0%, var(--teal-800) 55%, var(--green-700) 100%);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }

.sidebar-header {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-logo-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.sidebar-logo-text h2 { font-size: 14px; font-weight: 700; color: #fff; }
.sidebar-logo-text p  { font-size: 11px; color: rgba(255,255,255,.6); margin-top: 1px; }

.sidebar-user {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--blue-400), var(--green-400));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-info p    { font-size: 13px; font-weight: 600; color: #fff; }
.user-info span { font-size: 11px; color: rgba(255,255,255,.6); }

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

.nav-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.4);
  padding: 14px 20px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  cursor: pointer;
  border-radius: 0 8px 8px 0;
  margin: 1px 8px 1px 0;
  color: rgba(255,255,255,.75);
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  position: relative;
}
.nav-item:hover  { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active {
  background: rgba(255,255,255,.18);
  color: #fff;
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 4px; bottom: 4px;
  width: 3px;
  background: var(--blue-300);
  border-radius: 0 3px 3px 0;
}
.nav-icon { font-size: 16px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--orange);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.nav-badge.blue   { background: var(--blue-400); }
.nav-badge.green  { background: var(--green-500); }
.nav-badge.orange { background: var(--orange); }
.nav-badge.red    { background: var(--red); }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: rgba(255,255,255,.4);
}

/* ── Main Content ───────────────────────────────────────────── */
#mainContent {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────── */
.top-header {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.header-breadcrumb { font-size: 11px; color: var(--gray-400); margin-bottom: 2px; }
.header-title { font-size: 18px; font-weight: 700; color: var(--gray-800); }
.header-right { display: flex; align-items: center; gap: 16px; }
.header-date { font-size: 12px; color: var(--gray-500); }
.header-notif {
  position: relative; cursor: pointer;
  font-size: 20px;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--blue-50);
  border: 1px solid var(--blue-200);
}
.notif-dot {
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  position: absolute; top: 5px; right: 5px;
  border: 2px solid #fff;
}

.lang-switch {
  display: flex;
  background: var(--gray-100);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}
.lang-btn {
  border: none;
  background: transparent;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: all .15s;
}
.lang-btn.active {
  background: var(--blue-600);
  color: #fff;
}

/* ── Page Content ───────────────────────────────────────────── */
.page-content { flex: 1; overflow-y: auto; padding: 24px 28px; }
.page-content::-webkit-scrollbar { width: 6px; }
.page-content::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 6px; }

.section { display: none; }
.section.active { display: block; animation: fadeIn .2s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}
.page-header-left h1 { font-size: 22px; font-weight: 800; color: var(--gray-900); }
.page-header-left p  { font-size: 13px; color: var(--gray-500); margin-top: 3px; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}
.card-title { font-size: 14px; font-weight: 700; color: var(--gray-800); }
.card-body  { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Metric / KPI Cards ─────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.metric-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.metric-card.blue   { border-top: 3px solid var(--blue-500);  background: linear-gradient(135deg, #fff 70%, var(--blue-50)); }
.metric-card.green  { border-top: 3px solid var(--green-500); background: linear-gradient(135deg, #fff 70%, var(--green-50)); }
.metric-card.orange { border-top: 3px solid var(--orange);    background: linear-gradient(135deg, #fff 70%, var(--orange-bg)); }
.metric-card.red    { border-top: 3px solid var(--red);       background: linear-gradient(135deg, #fff 70%, var(--red-bg)); }
.metric-card.purple { border-top: 3px solid var(--purple);    background: linear-gradient(135deg, #fff 70%, var(--purple-bg)); }
.metric-card.teal   { border-top: 3px solid var(--teal-700);  background: linear-gradient(135deg, #fff 70%, var(--blue-50)); }

.metric-icon  { font-size: 24px; margin-bottom: 8px; }
.metric-label { font-size: 11px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.metric-value { font-size: 32px; font-weight: 800; color: var(--gray-900); line-height: 1.1; }
.metric-change { font-size: 11px; margin-top: 4px; color: var(--gray-500); }
.metric-change.up   { color: var(--green-600); }
.metric-change.down { color: var(--red-dark); }

/* ── Stat Pills ─────────────────────────────────────────────── */
.stat-pills {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.stat-pill {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 140px;
  box-shadow: var(--shadow);
}
.stat-pill-value { font-size: 22px; font-weight: 800; }
.stat-pill-label { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

/* ── Grids ──────────────────────────────────────────────────── */
.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.grid-2      { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3      { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4      { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }
.mb-18 { margin-bottom: 18px; }

/* ── Charts ─────────────────────────────────────────────────── */
.chart-container { position: relative; height: 240px; }
.chart-container canvas { max-height: 100%; }

/* ── Progress Bars ──────────────────────────────────────────── */
.progress-bar {
  background: var(--gray-200);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 99px; transition: width .5s ease; }
.progress-fill.blue   { background: linear-gradient(90deg, var(--blue-500), var(--blue-400)); }
.progress-fill.green  { background: linear-gradient(90deg, var(--green-600), var(--green-400)); }
.progress-fill.orange { background: linear-gradient(90deg, var(--orange-dark), var(--orange)); }
.progress-fill.red    { background: linear-gradient(90deg, var(--red-dark), var(--red)); }
.progress-fill.teal   { background: linear-gradient(90deg, var(--teal-700), var(--teal-800)); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
  color: #fff;
  box-shadow: 0 2px 4px rgba(2,132,199,.3);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--blue-700), var(--blue-800)); box-shadow: 0 3px 8px rgba(2,132,199,.4); }

.btn-success {
  background: linear-gradient(135deg, var(--green-600), var(--green-700));
  color: #fff;
  box-shadow: 0 2px 4px rgba(22,163,74,.3);
}
.btn-success:hover { background: linear-gradient(135deg, var(--green-700), #14532d); }

.btn-secondary {
  background: #fff;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  box-shadow: var(--shadow);
}
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-400); }

.btn-danger {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
}
.btn-danger:hover { background: linear-gradient(135deg, var(--red-dark), #b91c1c); }

.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-xs  { padding: 4px 9px;  font-size: 11px; }
.btn-full { width: 100%; justify-content: center; padding: 13px; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: #fff;
  color: var(--gray-800);
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 32px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.col-span-2 { grid-column: span 2; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Search Bar ─────────────────────────────────────────────── */
.search-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 14px; }
.search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--blue-400); }

/* ── Tables ─────────────────────────────────────────────────── */
.table-container { overflow-x: auto; }
table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  font-size: 13px;
  color: var(--gray-700);
}
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--blue-50); }
.text-sm   { font-size: 11px; }
.text-muted { color: var(--gray-400); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success  { background: var(--green-100);  color: var(--green-700); }
.badge-info     { background: var(--blue-100);   color: var(--blue-700); }
.badge-warning  { background: var(--orange-bg);  color: var(--orange-dark); border: 1px solid var(--orange-border); }
.badge-danger   { background: var(--red-bg);     color: var(--red-dark);  border: 1px solid var(--red-border); }
.badge-secondary{ background: var(--gray-100);   color: var(--gray-600); }
.badge-purple   { background: var(--purple-bg);  color: var(--purple); }

/* ── Priority dots ──────────────────────────────────────────── */
.priority-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.priority-dot.critical { background: var(--red); box-shadow: 0 0 0 3px rgba(239,68,68,.2); }
.priority-dot.high     { background: var(--orange); }
.priority-dot.medium   { background: #facc15; }
.priority-dot.low      { background: var(--green-500); }

/* ── Info Blocks ────────────────────────────────────────────── */
.info-block {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--blue-200);
  background: var(--blue-50);
  font-size: 13px;
  color: var(--blue-700);
  align-items: flex-start;
}
.info-block > span { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.info-block.warning { border-color: var(--orange-border); background: var(--orange-bg); color: var(--orange-dark); }
.info-block.danger  { border-color: var(--red-border);    background: var(--red-bg);    color: var(--red-dark); }
.info-block.success { border-color: var(--green-200);     background: var(--green-50);  color: var(--green-700); }

/* ── Risk Heatmap ───────────────────────────────────────────── */
.risk-heatmap {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  border: 1px solid rgba(0,0,0,.08);
}
.heatmap-cell:hover { transform: scale(1.08); box-shadow: var(--shadow-md); }
.heatmap-cell.low      { background: var(--green-100); color: var(--green-700); }
.heatmap-cell.medium   { background: #fef9c3;          color: #854d0e; }
.heatmap-cell.high     { background: var(--orange-bg); color: var(--orange-dark); }
.heatmap-cell.critical { background: var(--red-bg);    color: var(--red-dark); }

/* ── Activity Feed ──────────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
  align-items: flex-start;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--blue-100);
}
.activity-icon.green  { background: var(--green-100); }
.activity-icon.orange { background: var(--orange-bg); }
.activity-icon.red    { background: var(--red-bg); }
.activity-text { font-size: 12px; color: var(--gray-700); flex: 1; }
.activity-time { font-size: 11px; color: var(--gray-400); flex-shrink: 0; }

/* ── Score Badge ────────────────────────────────────────────── */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}
.score-badge.critical { background: var(--red-bg);    color: var(--red-dark); }
.score-badge.high     { background: var(--orange-bg); color: var(--orange-dark); }
.score-badge.medium   { background: #fef9c3;          color: #854d0e; }
.score-badge.low      { background: var(--green-100); color: var(--green-700); }

/* ── Modals ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: none; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--gray-400);
  cursor: pointer;
  line-height: 1;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  transition: background .15s;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-600); }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 22px;
  border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
}

/* ── Toast ──────────────────────────────────────────────────── */
#toastContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--gray-900);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  min-width: 260px;
  max-width: 380px;
  animation: slideUp .25s ease;
  border-left: 4px solid var(--blue-400);
}
.toast.success { border-left-color: var(--green-400); }
.toast.warning { border-left-color: var(--orange); }
.toast.error   { border-left-color: var(--red); }
.toast.info    { border-left-color: var(--blue-400); }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Skeleton Loader ────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton-card, .skeleton-table {
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 1200px 100%;
  animation: shimmer 1.6s infinite;
}
.skeleton-card  { height: 100px; }
.skeleton-table { height: 320px; margin-top: 16px; }

/* ── Sync progress ──────────────────────────────────────────── */
.sync-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  transition: all .3s;
}
.sync-step.done    { background: var(--green-50);  color: var(--green-700); border: 1px solid var(--green-200); }
.sync-step.running { background: var(--blue-50);   color: var(--blue-700);  border: 1px solid var(--blue-200); }
.sync-step.pending { background: var(--gray-50);   color: var(--gray-400);  border: 1px solid var(--gray-200); }

/* ── Affiliation Canvas ─────────────────────────────────────── */
#affiliationCanvas {
  width: 100%;
  height: 360px;
  border-radius: 8px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  display: block;
}

/* ── Utilities ──────────────────────────────────────────────── */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-16 { gap: 16px; }
.mt-12  { margin-top: 12px; }
.mb-12  { margin-bottom: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fs-11  { font-size: 11px; }
.fs-12  { font-size: 12px; }
.fs-13  { font-size: 13px; }
.color-blue   { color: var(--blue-600); }
.color-green  { color: var(--green-600); }
.color-orange { color: var(--orange-dark); }
.color-red    { color: var(--red-dark); }
.color-gray   { color: var(--gray-500); }

/* ── HR Tab tugmalari ───────────────────────────────────────── */
.hr-tab-btn {
  background: #fff;
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
  transition: all .15s;
}
.hr-tab-btn:hover {
  background: var(--blue-50);
  border-color: var(--blue-300);
  color: var(--blue-700);
}
.hr-tab-btn.active {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(2,132,199,.3);
}

/* ── Scrollbar (WebKit) ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 6px; }

/* ── Responsive (basic) ─────────────────────────────────────── */
@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid  { grid-template-columns: 1fr; }
  .grid-3       { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  #sidebar { display: none; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .grid-2  { grid-template-columns: 1fr; }
  .top-header { padding: 0 16px; }
  .page-content { padding: 16px; }
}
