/* =========================================================
   VMS — AI Theme (dark, glass, gradient)
   Loaded LAST so it overrides Bootstrap + legacy styles.
   ========================================================= */
:root {
  --ai-bg: #070a1a;
  --ai-bg-2: #0c1028;
  --ai-surface: rgba(20, 26, 56, 0.62);
  --ai-surface-solid: #121835;
  --ai-surface-2: rgba(255, 255, 255, 0.035);
  --ai-border: rgba(148, 163, 255, 0.12);
  --ai-border-strong: rgba(148, 163, 255, 0.25);
  --ai-text: #e6e9f5;
  --ai-text-2: #a3abc9;
  --ai-muted: #6b7399;
  --ai-violet: #8b5cf6;
  --ai-indigo: #6366f1;
  --ai-cyan: #22d3ee;
  --ai-pink: #ec4899;
  --ai-green: #10b981;
  --ai-amber: #f59e0b;
  --ai-red: #f43f5e;
  --ai-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 45%, #22d3ee 100%);
  --ai-grad-soft: linear-gradient(135deg, rgba(99,102,241,.18), rgba(34,211,238,.10));
  --ai-glow: 0 0 0 1px rgba(139,92,246,.35), 0 8px 32px rgba(99,102,241,.25);
  --ai-shadow: 0 20px 50px -20px rgba(0,0,0,.7);
  --ai-radius: 16px;
  --ai-sidebar-w: 268px;
  --ai-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ai-font-head: 'Space Grotesk', 'Poppins', sans-serif;
  --ai-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Bootstrap variable overrides */
  --bs-body-bg: var(--ai-bg);
  --bs-body-color: var(--ai-text);
  --bs-border-color: var(--ai-border);
  --bs-secondary-color: var(--ai-text-2);
  --bs-emphasis-color: #fff;
  --bs-link-color: #a5b4fc;
  --bs-link-hover-color: #c7d2fe;
  --bs-primary: #6366f1;
  --bs-primary-rgb: 99,102,241;
}

/* ---------- Base ---------- */
html, body { background: var(--ai-bg) !important; color: var(--ai-text); }
body {
  font-family: var(--ai-font);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
  min-height: 100vh;
}
body.ai-app::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(900px 600px at 85% -10%, rgba(139,92,246,.18), transparent 60%),
    radial-gradient(700px 500px at 10% 110%, rgba(34,211,238,.12), transparent 60%),
    radial-gradient(600px 400px at 40% 40%, rgba(99,102,241,.06), transparent 70%);
}
body.ai-app::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(148,163,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}
h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6 { font-family: var(--ai-font-head); color: #fff; letter-spacing: -0.02em; }
a { color: #a5b4fc; }
a:hover { color: #c7d2fe; }
.text-muted, .text-secondary { color: var(--ai-text-2) !important; }
.text-dark, .text-body { color: var(--ai-text) !important; }
.bg-light, .bg-white, .bg-body { background: transparent !important; }
hr { border-color: var(--ai-border); opacity: 1; }
::selection { background: rgba(139,92,246,.4); color: #fff; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,255,.18); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,255,.32); }

.ai-gradient-text {
  background: var(--ai-grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- Shell ---------- */
.ai-shell { display: flex; min-height: 100vh; }
.ai-main { flex: 1; min-width: 0; margin-left: var(--ai-sidebar-w); display: flex; flex-direction: column; transition: margin .3s ease; }
.ai-content { padding: 28px 32px 40px; flex: 1; animation: aiFadeUp .45s ease both; }
@keyframes aiFadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Sidebar ---------- */
.ai-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--ai-sidebar-w); z-index: 1040;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(12,16,40,.92), rgba(7,10,26,.96));
  border-right: 1px solid var(--ai-border);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  transition: transform .3s ease;
}
.ai-brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; text-decoration: none; }
.ai-brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--ai-grad); color: #fff; font-size: 18px; box-shadow: var(--ai-glow); position: relative;
}
.ai-brand-mark::after { content: ""; position: absolute; inset: -3px; border-radius: 14px; background: var(--ai-grad); filter: blur(10px); opacity: .45; z-index: -1; }
.ai-brand-title { font-family: var(--ai-font-head); font-weight: 700; font-size: 18px; color: #fff; line-height: 1.1; }
.ai-brand-sub { font-size: 11px; color: var(--ai-muted); letter-spacing: .08em; text-transform: uppercase; }

.ai-tenant-chip {
  margin: 0 16px 14px; padding: 10px 12px; border-radius: 12px; display: flex; align-items: center; gap: 10px;
  background: var(--ai-surface-2); border: 1px solid var(--ai-border); font-size: 13px;
}
.ai-tenant-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ai-green); box-shadow: 0 0 10px var(--ai-green); }
.ai-tenant-chip .tier { margin-left: auto; font-size: 10px; padding: 2px 8px; border-radius: 99px; background: var(--ai-grad-soft); color: #c4b5fd; border: 1px solid var(--ai-border-strong); text-transform: uppercase; letter-spacing: .06em; }

.ai-nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.ai-nav-label { font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ai-muted); padding: 16px 12px 8px; }
.ai-nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 2px 0; border-radius: 10px;
  color: var(--ai-text-2); text-decoration: none; font-size: 14px; font-weight: 500; position: relative;
  transition: background .2s, color .2s, transform .2s;
}
.ai-nav-link i { width: 18px; text-align: center; font-size: 14px; opacity: .85; }
.ai-nav-link:hover { background: rgba(148,163,255,.07); color: #fff; transform: translateX(2px); }
.ai-nav-link.active { color: #fff; background: linear-gradient(90deg, rgba(99,102,241,.22), rgba(139,92,246,.06)); box-shadow: inset 0 0 0 1px rgba(139,92,246,.25); }
.ai-nav-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--ai-grad); box-shadow: 0 0 12px var(--ai-violet); }
.ai-nav-link.active i { color: #c4b5fd; opacity: 1; }
.ai-nav-link .ai-pill { margin-left: auto; font-size: 10px; padding: 1px 7px; border-radius: 99px; background: rgba(244,63,94,.15); color: #fda4af; border: 1px solid rgba(244,63,94,.3); }
.ai-nav-link .ai-pill.live { background: rgba(16,185,129,.12); color: #6ee7b7; border-color: rgba(16,185,129,.3); }

.ai-sidebar-foot { padding: 14px; border-top: 1px solid var(--ai-border); }
.ai-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--ai-surface-2); border: 1px solid var(--ai-border); }
.ai-avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--ai-grad); flex-shrink: 0; font-size: 14px; }
.ai-user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-user-role { font-size: 11px; color: var(--ai-muted); text-transform: capitalize; }
.ai-user .logout { margin-left: auto; color: var(--ai-muted); padding: 6px; border-radius: 8px; }
.ai-user .logout:hover { color: var(--ai-red); background: rgba(244,63,94,.1); }

/* ---------- Topbar ---------- */
.ai-topbar {
  position: sticky; top: 0; z-index: 1030; height: 68px; display: flex; align-items: center; gap: 16px; padding: 0 32px;
  background: rgba(7,10,26,.6); backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--ai-border);
}
.ai-crumb { display: flex; flex-direction: column; min-width: 0; }
.ai-crumb small { font-size: 11px; color: var(--ai-muted); letter-spacing: .06em; text-transform: uppercase; }
.ai-crumb h1 { font-size: 18px; margin: 0; font-weight: 600; white-space: nowrap; }
.ai-search { flex: 1; max-width: 460px; margin: 0 auto; position: relative; }
.ai-search input {
  width: 100%; height: 40px; padding: 0 70px 0 40px; border-radius: 12px; font-size: 14px;
  background: var(--ai-surface-2); border: 1px solid var(--ai-border); color: var(--ai-text); outline: none; transition: .2s;
}
.ai-search input::placeholder { color: var(--ai-muted); }
.ai-search input:focus { border-color: rgba(139,92,246,.5); box-shadow: 0 0 0 4px rgba(139,92,246,.12); background: rgba(255,255,255,.05); }
.ai-search > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ai-muted); font-size: 14px; }
.ai-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-family: var(--ai-mono); font-size: 11px; padding: 3px 7px; border-radius: 6px; background: rgba(255,255,255,.06); border: 1px solid var(--ai-border); color: var(--ai-text-2); }
.ai-top-actions { display: flex; align-items: center; gap: 8px; }
.ai-icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; position: relative;
  background: var(--ai-surface-2); border: 1px solid var(--ai-border); color: var(--ai-text-2); transition: .2s; text-decoration: none;
}
.ai-icon-btn:hover { color: #fff; border-color: var(--ai-border-strong); background: rgba(148,163,255,.08); }
.ai-icon-btn .badge-dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--ai-pink); box-shadow: 0 0 0 2px var(--ai-bg), 0 0 10px var(--ai-pink); animation: aiPulse 2s infinite; }
.ai-status { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 12px; font-size: 12.5px; color: #6ee7b7; background: rgba(16,185,129,.08); border: 1px solid rgba(16,185,129,.22); }
.ai-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ai-green); box-shadow: 0 0 8px var(--ai-green); animation: aiPulse 2s infinite; }
.ai-user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 12px; border: 1px solid var(--ai-border); background: var(--ai-surface-2); color: var(--ai-text); text-decoration: none; }
.ai-user-btn:hover { border-color: var(--ai-border-strong); color: #fff; }
.ai-user-btn .ai-avatar { width: 32px; height: 32px; font-size: 13px; }
.ai-menu-toggle { display: none; }
@keyframes aiPulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* ---------- Cards ---------- */
.card {
  background: var(--ai-surface) !important; color: var(--ai-text);
  border: 1px solid var(--ai-border) !important; border-radius: var(--ai-radius) !important;
  box-shadow: var(--ai-shadow) !important; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease; overflow: hidden;
}
.card:hover { border-color: var(--ai-border-strong) !important; }
.card-header, .card-footer {
  background: transparent !important; border-color: var(--ai-border) !important; color: #fff;
  padding: 16px 20px; font-weight: 600; font-family: var(--ai-font-head);
}
.card-body { padding: 20px; }
.card-title { color: #fff; }
.shadow, .shadow-sm, .shadow-lg { box-shadow: var(--ai-shadow) !important; }

/* Stat cards (any .stat-card OR bootstrap cards with border-start) */
.stat-card, .card.border-start, .card[class*="border-left"] { position: relative; }
.stat-card::before, .card.border-start::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--ai-grad); opacity: .9;
}
.stat-card:hover, .card.border-start:hover { transform: translateY(-3px); box-shadow: var(--ai-glow), var(--ai-shadow) !important; }
.border-start { border-left: 1px solid var(--ai-border) !important; }
.stat-card h2, .stat-card h3, .stat-card .display-6, .card.border-start h2, .card.border-start h3 {
  font-family: var(--ai-font-head); font-weight: 700; color: #fff;
}

/* AI stat (used by redesigned dashboards) */
.ai-stat { padding: 20px; border-radius: var(--ai-radius); background: var(--ai-surface); border: 1px solid var(--ai-border); position: relative; overflow: hidden; transition: .25s; }
.ai-stat:hover { transform: translateY(-3px); border-color: var(--ai-border-strong); box-shadow: var(--ai-glow); }
.ai-stat .icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; color: #fff; }
.ai-stat .value { font-family: var(--ai-font-head); font-size: 32px; font-weight: 700; color: #fff; line-height: 1; margin-top: 16px; }
.ai-stat .label { color: var(--ai-text-2); font-size: 13px; margin-top: 6px; }
.ai-stat .trend { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 99px; }
.ai-stat::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: var(--glow, rgba(99,102,241,.25)); filter: blur(40px); opacity: .6; }

/* ---------- Buttons ---------- */
.btn { border-radius: 10px; font-weight: 500; padding: .5rem 1rem; transition: all .2s ease; letter-spacing: -.005em; }
.btn-sm { border-radius: 8px; padding: .3rem .7rem; }
.btn-lg { border-radius: 12px; }
.btn-primary { background: var(--ai-grad) !important; border: 0 !important; color: #fff !important; box-shadow: 0 6px 20px -6px rgba(99,102,241,.6); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 28px -6px rgba(139,92,246,.75); filter: brightness(1.08); }
.btn-success { background: linear-gradient(135deg,#10b981,#059669) !important; border: 0 !important; }
.btn-danger { background: linear-gradient(135deg,#f43f5e,#e11d48) !important; border: 0 !important; }
.btn-warning { background: linear-gradient(135deg,#f59e0b,#d97706) !important; border: 0 !important; color: #fff !important; }
.btn-info { background: linear-gradient(135deg,#22d3ee,#0891b2) !important; border: 0 !important; color: #fff !important; }
.btn-secondary, .btn-light, .btn-dark { background: var(--ai-surface-2) !important; border: 1px solid var(--ai-border) !important; color: var(--ai-text) !important; }
.btn-secondary:hover, .btn-light:hover, .btn-dark:hover { border-color: var(--ai-border-strong) !important; color: #fff !important; }
[class*="btn-outline-"] { background: transparent; border-color: var(--ai-border-strong); color: var(--ai-text); }
.btn-outline-primary { color: #a5b4fc; border-color: rgba(99,102,241,.45); }
.btn-outline-primary:hover { background: rgba(99,102,241,.15); color: #fff; border-color: rgba(139,92,246,.7); }
.btn-outline-secondary:hover, .btn-outline-light:hover, .btn-outline-dark:hover { background: rgba(148,163,255,.08); color: #fff; border-color: var(--ai-border-strong); }
.btn-outline-danger { color: #fda4af; border-color: rgba(244,63,94,.4); }
.btn-outline-danger:hover { background: rgba(244,63,94,.15); color: #fff; border-color: rgba(244,63,94,.7); }
.btn-outline-success { color: #6ee7b7; border-color: rgba(16,185,129,.4); }
.btn-outline-success:hover { background: rgba(16,185,129,.15); color: #fff; }

/* ---------- Forms ---------- */
.form-control, .form-select, .input-group-text, textarea {
  background-color: rgba(255,255,255,.04) !important; border: 1px solid var(--ai-border) !important;
  color: var(--ai-text) !important; border-radius: 10px; transition: .2s;
}
.form-control::placeholder { color: var(--ai-muted) !important; }
.form-control:focus, .form-select:focus {
  border-color: rgba(139,92,246,.55) !important; box-shadow: 0 0 0 4px rgba(139,92,246,.14) !important; background-color: rgba(255,255,255,.06) !important;
}
.form-select { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23a3abc9' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important; }
.form-select option { background: var(--ai-surface-solid); color: var(--ai-text); }
.input-group-text { color: var(--ai-text-2) !important; }
.form-label { color: var(--ai-text-2); font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.form-check-input { background-color: rgba(255,255,255,.06); border-color: var(--ai-border-strong); }
.form-check-input:checked { background-color: var(--ai-indigo); border-color: var(--ai-indigo); box-shadow: 0 0 10px rgba(99,102,241,.5); }
.form-text { color: var(--ai-muted); }

/* ---------- Tables / DataTables ---------- */
.table { --bs-table-bg: transparent; --bs-table-color: var(--ai-text); --bs-table-border-color: var(--ai-border); --bs-table-striped-bg: rgba(255,255,255,.015); --bs-table-hover-bg: rgba(139,92,246,.06); --bs-table-hover-color: #fff; color: var(--ai-text); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 14px 16px; border-bottom-color: var(--ai-border); background: transparent; color: inherit; }
.table thead th, .table-light th, .table-dark th, thead.table-light th {
  background: rgba(255,255,255,.02) !important; color: var(--ai-muted) !important; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--ai-border) !important;
}
.table-hover > tbody > tr:hover > * { background: rgba(139,92,246,.06); color: #fff; }
.table-responsive { border-radius: 12px; }
.dataTables_wrapper { color: var(--ai-text-2); }
.dataTables_wrapper .dataTables_length select, .dataTables_wrapper .dataTables_filter input {
  background: rgba(255,255,255,.04) !important; border: 1px solid var(--ai-border) !important; color: var(--ai-text) !important; border-radius: 10px; padding: 6px 10px;
}
.dataTables_wrapper .dataTables_filter input:focus { border-color: rgba(139,92,246,.55) !important; outline: none; box-shadow: 0 0 0 4px rgba(139,92,246,.14); }
.dataTables_wrapper .dataTables_info { color: var(--ai-muted) !important; font-size: 13px; }
.page-link { background: var(--ai-surface-2) !important; border-color: var(--ai-border) !important; color: var(--ai-text-2) !important; margin: 0 2px; border-radius: 8px !important; }
.page-link:hover { background: rgba(139,92,246,.12) !important; color: #fff !important; }
.page-item.active .page-link { background: var(--ai-grad) !important; border-color: transparent !important; color: #fff !important; box-shadow: 0 4px 14px -4px rgba(99,102,241,.7); }
.page-item.disabled .page-link { opacity: .4; }
table.dataTable td.dataTables_empty { color: var(--ai-muted); padding: 40px !important; }
table.dataTable thead > tr > th.sorting::before, table.dataTable thead > tr > th.sorting::after { opacity: .3; }

/* ---------- Badges / Alerts ---------- */
.badge { font-weight: 600; font-size: 11px; padding: .4em .75em; border-radius: 99px; letter-spacing: .02em; }
.badge.bg-primary, .bg-primary.badge { background: rgba(99,102,241,.16) !important; color: #c7d2fe !important; border: 1px solid rgba(99,102,241,.35); }
.badge.bg-success { background: rgba(16,185,129,.14) !important; color: #6ee7b7 !important; border: 1px solid rgba(16,185,129,.35); }
.badge.bg-danger { background: rgba(244,63,94,.14) !important; color: #fda4af !important; border: 1px solid rgba(244,63,94,.35); }
.badge.bg-warning { background: rgba(245,158,11,.14) !important; color: #fcd34d !important; border: 1px solid rgba(245,158,11,.35); }
.badge.bg-info { background: rgba(34,211,238,.14) !important; color: #67e8f9 !important; border: 1px solid rgba(34,211,238,.35); }
.badge.bg-secondary, .badge.bg-light, .badge.bg-dark { background: rgba(148,163,255,.1) !important; color: var(--ai-text-2) !important; border: 1px solid var(--ai-border); }
.alert { border-radius: 12px; border: 1px solid; backdrop-filter: blur(10px); }
.alert-danger { background: rgba(244,63,94,.1); border-color: rgba(244,63,94,.3); color: #fecdd3; }
.alert-success { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.3); color: #a7f3d0; }
.alert-warning { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: #fde68a; }
.alert-info, .alert-primary { background: rgba(99,102,241,.1); border-color: rgba(99,102,241,.3); color: #c7d2fe; }

/* Bootstrap color helpers on dark */
.bg-primary:not(.badge):not(.btn) { background: var(--ai-grad) !important; }
.bg-success:not(.badge) { background: linear-gradient(135deg,#10b981,#059669) !important; }
.bg-danger:not(.badge) { background: linear-gradient(135deg,#f43f5e,#be123c) !important; }
.bg-warning:not(.badge) { background: linear-gradient(135deg,#f59e0b,#b45309) !important; }
.bg-info:not(.badge) { background: linear-gradient(135deg,#22d3ee,#0e7490) !important; }
.text-primary { color: #a5b4fc !important; }
.text-success { color: #6ee7b7 !important; }
.text-danger { color: #fda4af !important; }
.text-warning { color: #fcd34d !important; }
.text-info { color: #67e8f9 !important; }

/* ---------- Dropdowns / Modals / Nav ---------- */
.dropdown-menu { background: rgba(18,24,53,.96); border: 1px solid var(--ai-border-strong); border-radius: 14px; padding: 6px; box-shadow: var(--ai-shadow); backdrop-filter: blur(16px); }
.dropdown-item { color: var(--ai-text-2); border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.dropdown-item:hover, .dropdown-item:focus { background: rgba(139,92,246,.12); color: #fff; }
.dropdown-divider { border-color: var(--ai-border); }
.dropdown-header { color: var(--ai-muted); }
.modal-content { background: rgba(18,24,53,.92); border: 1px solid var(--ai-border-strong); border-radius: 20px; backdrop-filter: blur(20px); color: var(--ai-text); box-shadow: 0 30px 80px -20px rgba(0,0,0,.8); }
.modal-header, .modal-footer { border-color: var(--ai-border); }
.modal-backdrop.show { opacity: .7; backdrop-filter: blur(4px); }
.btn-close { filter: invert(1) grayscale(1) brightness(1.6); }

.modal-header .btn-close {
  --bs-btn-close-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
  opacity: .85;
}
.modal-header .btn-close:hover { opacity: 1; }


.nav-tabs { border-color: var(--ai-border); }
.nav-tabs .nav-link { color: var(--ai-text-2); border: 0; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active { background: transparent; color: #fff; border-bottom-color: var(--ai-violet); }
.nav-pills .nav-link.active { background: var(--ai-grad); }
.list-group-item { background: transparent; color: var(--ai-text); border-color: var(--ai-border); }
.progress { background: rgba(255,255,255,.06); border-radius: 99px; height: 8px; }
.progress-bar { background: var(--ai-grad); box-shadow: 0 0 12px rgba(139,92,246,.6); }

/* SweetAlert2 dark */
.swal2-popup { background: #121835 !important; color: var(--ai-text) !important; border: 1px solid var(--ai-border-strong); border-radius: 20px !important; }
.swal2-title { color: #fff !important; }
.swal2-html-container { color: var(--ai-text-2) !important; }
.swal2-confirm { background: var(--ai-grad) !important; border-radius: 10px !important; }
.swal2-input, .swal2-textarea, .swal2-select { background: rgba(255,255,255,.04) !important; color: var(--ai-text) !important; border: 1px solid var(--ai-border) !important; }

/* Footer */
.ai-footer { padding: 18px 32px; border-top: 1px solid var(--ai-border); color: var(--ai-muted); font-size: 12.5px; display: flex; justify-content: space-between; }

/* Page header helper */
.ai-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.ai-page-head h2 { margin: 0; font-size: 26px; font-weight: 700; }
.ai-page-head p { margin: 4px 0 0; color: var(--ai-text-2); }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .ai-sidebar { transform: translateX(-100%); }
  body.ai-sidebar-open .ai-sidebar { transform: none; box-shadow: 30px 0 80px rgba(0,0,0,.6); }
  .ai-main { margin-left: 0; }
  .ai-menu-toggle { display: grid; }
  .ai-search { display: none; }
  .ai-content { padding: 20px 16px 32px; }
  .ai-topbar { padding: 0 16px; }
  .ai-status { display: none; }
}
@media print {
  .ai-sidebar, .ai-topbar, .ai-footer { display: none !important; }
  .ai-main { margin: 0; }
  body, .card { background: #fff !important; color: #000 !important; }
}
