@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg: #070d1a;
  --surface: #0f1729;
  --surface2: #162038;
  --surface3: #1e2d4a;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-glow: rgba(59,130,246,0.25);
  --accent: #f59e0b;
  --accent-glow: rgba(245,158,11,0.2);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text: #f1f5f9;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(59,130,246,0.4);
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 40px rgba(59,130,246,0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 99px; }

/* ── AUTH SCREEN ── */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 24px;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(59,130,246,0.12) 0%, transparent 70%),
              radial-gradient(ellipse 60% 50% at 90% 80%, rgba(245,158,11,0.07) 0%, transparent 60%),
              var(--bg);
}

.auth-grid-bg {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(59,130,246,0.05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(59,130,246,0.05) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
}

.auth-card {
  background: rgba(15,23,41,0.85);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow), var(--shadow-glow);
  position: relative;
  z-index: 1;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  justify-content: center;
}

.auth-logo-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 20px var(--primary-glow);
  font-size: 22px;
}

.auth-logo h1 {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-logo span {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  display: block;
  margin-top: -2px;
}

.auth-tabs {
  display: flex;
  background: var(--surface);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 28px;
  border: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.auth-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 12px var(--primary-glow);
}

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 7px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: var(--surface2);
}

.form-group input::placeholder { color: var(--text-muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
  width: 100%;
  padding: 14px;
  font-size: 15px;
  margin-top: 8px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 25px var(--primary-glow);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--surface3); border-color: var(--border-hover); }

.btn-danger { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-success { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.btn-success:hover { background: rgba(16,185,129,0.25); }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; border-radius: 8px; }

/* ── APP LAYOUT ── */
#app-screen { display: none; min-height: 100vh; }

#app-screen.visible { display: flex; }

.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 15px var(--primary-glow);
}

.sidebar-logo h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.sidebar-logo small { font-size: 10px; color: var(--accent); font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  position: relative;
}

.nav-item:hover { background: var(--surface2); color: var(--text); }

.nav-item.active {
  background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(59,130,246,0.1));
  color: var(--primary);
  border-color: rgba(59,130,246,0.25);
}

.nav-item .nav-icon { font-size: 18px; width: 20px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
}

.nav-badge.danger { background: var(--danger); }

/* ── NAV GROUP (collapsible) ── */
.nav-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  position: relative;
  user-select: none;
}

.nav-group-header:hover { background: var(--surface2); color: var(--text); }

.nav-group-header .nav-icon { font-size: 18px; width: 20px; text-align: center; }

.nav-group-arrow {
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.25s;
  color: var(--text-muted);
}

.nav-group.open .nav-group-arrow { transform: rotate(90deg); }

.nav-group-children {
  display: none;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
  overflow: hidden;
}

.nav-group.open .nav-group-children { display: flex; }

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px 9px 38px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  position: relative;
}

.nav-sub-item::before {
  content: '';
  position: absolute;
  left: 22px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transform: translateY(-50%);
  transition: background 0.2s;
}

.nav-sub-item:hover { background: var(--surface2); color: var(--text); }
.nav-sub-item:hover::before { background: var(--text); }

.nav-sub-item.active {
  background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(59,130,246,0.1));
  color: var(--primary);
  border-color: rgba(59,130,246,0.25);
}

.nav-sub-item.active::before { background: var(--primary); }

[dir="rtl"] .nav-sub-item { padding: 9px 38px 9px 14px; }
[dir="rtl"] .nav-sub-item::before { left: auto; right: 22px; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.user-card:hover { border-color: var(--border-hover); }

.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-info strong { font-size: 13px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info span { font-size: 11px; color: var(--text-muted); }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: 260px;
  flex: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 64px;
  background: rgba(10,15,30,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar-subtitle { font-size: 12px; color: var(--text-muted); font-weight: 400; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.notif-btn {
  position: relative;
  width: 38px; height: 38px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  color: var(--text-dim);
}

.notif-btn:hover { border-color: var(--border-hover); color: var(--text); }

.notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.page-content { padding: 28px; flex: 1; overflow-y: auto; }

/* ── PAGES ── */
.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }

/* ── STATS GRID ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
}

.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.1;
}

.stat-card.blue::before { background: var(--primary); }
.stat-card.amber::before { background: var(--accent); }
.stat-card.green::before { background: var(--success); }
.stat-card.red::before { background: var(--danger); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 16px;
}

.stat-card.blue .stat-icon { background: rgba(59,130,246,0.15); }
.stat-card.amber .stat-icon { background: rgba(245,158,11,0.15); }
.stat-card.green .stat-icon { background: rgba(16,185,129,0.15); }
.stat-card.red .stat-icon { background: rgba(239,68,68,0.15); }

.stat-value { font-size: 32px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 24px; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead tr { border-bottom: 1px solid var(--border); }

th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 12px 16px;
}

td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

.td-actions { display: flex; align-items: center; gap: 6px; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}

.badge-blue { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.badge-green { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-amber { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-red { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.badge-gray { background: rgba(100,116,139,0.15); color: #94a3b8; border: 1px solid rgba(100,116,139,0.3); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transform: scale(0.96);
  transition: transform 0.2s;
  overflow: hidden;
}

.modal-overlay.open .modal { transform: scale(1); }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
}

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
}

.modal-close:hover { background: var(--surface3); color: var(--text); }

.modal-body {
  padding: 24px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex: 0 0 auto;
}

/* ── ACTIVITY FEED ── */
.feed { display: flex; flex-direction: column; gap: 0; }

.feed-item {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  position: relative;
}

.feed-item:last-child { border-bottom: none; }

.feed-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.feed-content { flex: 1; }
.feed-title { font-size: 14px; font-weight: 500; margin-bottom: 3px; }
.feed-meta { font-size: 12px; color: var(--text-muted); }
.feed-time { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ── ASSISTANT CHAT FEED ── */
.assistant-feed { display: flex; flex-direction: column; gap: 12px; }

.assistant-msg {
  display: flex;
  gap: 12px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }

.assistant-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.msg-bubble {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px 12px 12px 12px;
  padding: 12px 16px;
  max-width: 600px;
  flex: 1;
}

.msg-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.msg-header strong { font-size: 13px; color: var(--primary); }
.msg-header time { font-size: 11px; color: var(--text-muted); }
.msg-text { font-size: 14px; line-height: 1.6; }
.msg-case-tag { display: inline-block; background: var(--surface3); border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; color: var(--accent); margin-top: 6px; }

/* ── STEP WIZARD ── */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface3);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.step.done .step-num { background: var(--success); border-color: var(--success); color: white; }
.step.active .step-num { background: var(--primary); border-color: var(--primary); color: white; box-shadow: 0 0 12px var(--primary-glow); }

.step-label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.step.active .step-label { color: var(--text); }
.step.done .step-label { color: var(--success); }
.step-line { flex: 1; height: 1px; background: var(--border); margin: 0 8px; }
.step.done + .step-line { background: var(--success); }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h4 { font-size: 16px; color: var(--text-dim); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ── SETTINGS ── */
.settings-section { margin-bottom: 32px; }
.settings-section h4 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 16px; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: all 0.2s;
}

.setting-row:hover { border-color: var(--border-hover); }
.setting-label strong { font-size: 14px; display: block; margin-bottom: 2px; }
.setting-label span { font-size: 12px; color: var(--text-muted); }

/* ── TOGGLE ── */
.toggle {
  position: relative;
  width: 44px; height: 24px;
  cursor: pointer;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute; inset: 0;
  background: var(--surface3);
  border-radius: 99px;
  transition: background 0.2s;
  border: 1px solid var(--border);
}

.toggle input:checked + .toggle-track { background: var(--primary); border-color: var(--primary); }

.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.toggle input:checked ~ .toggle-thumb { transform: translateX(20px); }

/* ── SELECT ── */
select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 10px 14px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}

select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

/* ── GRID LAYOUTS ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ── SEARCH BAR ── */
.search-bar {
  position: relative;
}

.search-bar input {
  padding-left: 38px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  height: 38px;
  outline: none;
  transition: all 0.2s;
  width: 220px;
}

.search-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; pointer-events: none; }

/* ── SJC LOCK ICON ── */
.sjc-status { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.sjc-lock { font-size: 14px; }

/* ── TOAST ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }

.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease;
  max-width: 320px;
}

@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

.toast.success { border-color: rgba(16,185,129,0.4); }
.toast.error { border-color: rgba(239,68,68,0.4); }
.toast.info { border-color: rgba(59,130,246,0.4); }

/* ── PROGRESS BAR ── */
.progress-bar { height: 6px; background: var(--surface3); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #7c3aed); border-radius: 99px; transition: width 0.4s ease; }

/* ── CASE CARD ── */
.case-list { display: flex; flex-direction: column; gap: 10px; }

.case-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
}

.case-card:hover { border-color: var(--border-hover); }

/* Monitoring-blocked state — case whose auto-check is on but the scheduler
   will skip it (plan expired or missing credentials). The inline style on the
   element sets the red border + diagonal-stripe pattern; this hover rule keeps
   the red border dominant over the generic :hover rule above. */
.case-card.monitoring-blocked { border-color: #ef4444 !important; }
.case-card.monitoring-blocked:hover {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 1px rgba(239,68,68,.35), 0 6px 18px rgba(239,68,68,.22) !important;
}

.case-num { font-size: 16px; font-weight: 700; color: var(--primary); flex-shrink: 0; min-width: 120px; }

.case-info { flex: 1; }
.case-info p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.case-actions { display: flex; align-items: center; gap: 8px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .two-col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── SPINNER ── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.btn-checking {
  opacity: 0.85;
  cursor: not-allowed;
  pointer-events: none;
}

.spinner-icon {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}

/* ── CASE RESULT PANEL ── */
.case-result-panel {
  margin-top: 12px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: fadeIn 0.3s ease;
  font-size: 13px;
  line-height: 1.7;
}

.case-result-panel.found {
  border-color: rgba(16,185,129,0.35);
  background: rgba(16,185,129,0.05);
}

.case-result-panel.not-found {
  border-color: rgba(245,158,11,0.35);
  background: rgba(245,158,11,0.05);
}

.case-result-panel .result-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.case-result-panel .result-row {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.case-result-panel .result-row:last-child { border-bottom: none; }

.case-result-panel .result-label {
  color: var(--text-muted);
  min-width: 130px;
  font-weight: 500;
}

.case-result-panel .result-value {
  color: var(--text);
  font-weight: 400;
  flex: 1;
}

/* -------------------------------------------
   RTL / Arabic Language Support
-------------------------------------------- */
[dir="rtl"] .sidebar {
  border-right: none;
  border-left: 1px solid var(--border);
  left: auto;
  right: 0;
}
[dir="rtl"] .main-content {
  margin-left: 0;
  margin-right: 260px;
  direction: rtl;
}
[dir="rtl"] .sidebar-logo,
[dir="rtl"] .nav-item,
[dir="rtl"] .nav-label,
[dir="rtl"] .user-card {
  direction: rtl;
  text-align: right;
}
[dir="rtl"] .topbar { direction: rtl; }
[dir="rtl"] .topbar-actions { margin-left: 0; margin-right: auto; flex-direction: row-reverse; }
[dir="rtl"] .case-card { direction: rtl; }
[dir="rtl"] .case-actions { direction: ltr; }  /* buttons stay LTR */
[dir="rtl"] .modal { direction: rtl; }
[dir="rtl"] .modal-header { direction: rtl; }
[dir="rtl"] .form-group label { text-align: right; display: block; }
[dir="rtl"] input, [dir="rtl"] select, [dir="rtl"] textarea { text-align: right; direction: rtl; }
[dir="rtl"] .stat-card { direction: rtl; }
[dir="rtl"] .feed-item { direction: rtl; }
[dir="rtl"] .table-wrap table { direction: rtl; }
[dir="rtl"] th, [dir="rtl"] td { text-align: right; }
[dir="rtl"] .card-header { direction: rtl; }
[dir="rtl"] .card-header h3, [dir="rtl"] .card-header h4 { text-align: right; }
[dir="rtl"] .setting-row { direction: rtl; }
[dir="rtl"] .setting-label { text-align: right; }
[dir="rtl"] .two-col { direction: rtl; }
[dir="rtl"] .badge { direction: ltr; }
[dir="rtl"] .nav-badge { margin-left: 0; margin-right: auto; }
[dir="rtl"] .sidebar-footer { direction: rtl; }
[dir="rtl"] .topbar-title, [dir="rtl"] .topbar-subtitle { text-align: right; }
[dir="rtl"] .search-bar input { padding-left: 12px; padding-right: 38px; }
[dir="rtl"] .search-icon { left: auto; right: 12px; }
[dir="rtl"] .case-result-panel button[onclick*="closeResultPanel"] { right: auto !important; left: 12px !important; }
[dir="rtl"] .case-result-panel { direction: rtl; }
[dir="rtl"] .case-result-panel .result-label { text-align: right; }

/* Logo sizing for both languages */
.sidebar-logo-icon { width: 64px; height: 64px; font-size: 32px; }
.auth-logo-icon { width: 96px; height: 96px; font-size: 48px; }

@media (max-width: 768px) {
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  [dir="rtl"] .sidebar.open { transform: translateX(0); }
  [dir="rtl"] .main-content { margin-right: 0; }
}

/* Pulsing red animation for new notification badge */
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 8px rgba(239,68,68,.5); }
  50%       { box-shadow: 0 0 18px rgba(239,68,68,.9), 0 0 6px rgba(239,68,68,.4); }
}

/* ══════════════════════════════════════════════════════════════════
   MODERN SETTINGS PAGE
   ══════════════════════════════════════════════════════════════════ */
.settings-shell {
  max-width: 1060px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 6px 0 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.settings-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px;
}

.settings-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
  white-space: nowrap;
}
.settings-tab:hover { color: var(--text); background: var(--surface2); }
.settings-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 4px 14px var(--primary-glow);
}
.settings-tab-icon { font-size: 15px; line-height: 1; }

.settings-autosave-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}
.settings-autosave-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(16,185,129,.6);
}
.settings-autosave-status {
  color: var(--success);
  font-weight: 600;
  opacity: 0;
  transition: opacity .2s;
  min-width: 0;
}

.settings-panel { display: none; animation: settingsFadeIn .18s ease-out; }
.settings-panel.active { display: block; }
@keyframes settingsFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,0.02);
  margin-bottom: 18px;
}
.settings-card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.settings-card-header h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0;
  text-transform: none;
  margin: 0;
}
.settings-card-sub { font-size: 12.5px; color: var(--text-muted); }
.settings-card-body { padding: 20px 22px; }
.settings-card-body-tight { padding: 10px 12px; }
.settings-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
[dir="rtl"] .settings-card-actions { justify-content: flex-start; }

.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(245,158,11,0.04));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.profile-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: white;
  box-shadow: 0 4px 14px var(--primary-glow);
  flex-shrink: 0;
}
.profile-hero-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile-hero-info strong { font-size: 16px; color: var(--text); }
.profile-hero-info span { font-size: 13px; color: var(--text-muted); word-break: break-all; }

.settings-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.settings-form .form-group { margin: 0; }
.settings-form .form-group-full { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .settings-form { grid-template-columns: 1fr; }
}

.option-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  transition: background .15s;
}
.option-row + .option-row { border-top: 1px solid var(--border); border-radius: 0; }
.option-row:hover { background: var(--surface2); }
.option-row-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.option-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.option-row-text strong { font-size: 14px; color: var(--text); font-weight: 600; }
.option-row-text span { font-size: 12.5px; color: var(--text-muted); }
[dir="rtl"] .option-row { direction: rtl; }

.interval-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.interval-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  transition: all .15s;
}
[dir="rtl"] .interval-card { text-align: right; align-items: flex-end; }
.interval-card:hover { border-color: var(--border-hover); background: var(--surface3); }
.interval-card.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(59,130,246,0.04));
  box-shadow: 0 0 0 1px var(--primary), 0 6px 16px var(--primary-glow);
}
.interval-card-value { font-size: 20px; font-weight: 700; color: var(--text); }
.interval-card.active .interval-card-value { color: var(--primary); }
.interval-card-label { font-size: 12px; color: var(--text-muted); }
.interval-card-test { opacity: 0.75; }
.interval-card-test .interval-card-value::after {
  content: 'TEST';
  margin-left: 8px;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent);
  color: #000;
  vertical-align: middle;
  letter-spacing: 1px;
}

.segmented {
  display: inline-flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.segmented-option {
  padding: 9px 22px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}
.segmented-option:hover { color: var(--text); }
.segmented-option.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 3px 10px var(--primary-glow);
}

@media (max-width: 640px) {
  .settings-topbar { flex-direction: column; align-items: stretch; }
  .settings-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .settings-autosave-pill { align-self: flex-start; }
}
