/* Syntra AI — modern dark UI (glass surfaces, pill controls) on top of Bootstrap 5.3 (data-bs-theme="dark").
   Every page uses these ra-* classes; change the look here, not in the views. */
:root {
  --ra-bg: #07080c;
  --ra-surface: rgba(255, 255, 255, .035);       /* glass card */
  --ra-surface-solid: #0e1016;                   /* where blur isn't possible (dropdowns, modals) */
  --ra-surface-2: rgba(255, 255, 255, .06);      /* inputs, chips, hover */
  --ra-surface-3: rgba(255, 255, 255, .09);
  --ra-border: rgba(255, 255, 255, .08);
  --ra-border-strong: rgba(255, 255, 255, .14);
  --ra-text: #eef0f6;
  --ra-muted: #8b90a3;
  --ra-faint: #5c6175;
  --ra-violet: #8b5cf6;
  --ra-cyan: #22d3ee;
  --ra-indigo: #6366f1;
  --ra-grad: linear-gradient(120deg, #8b5cf6 0%, #6366f1 45%, #22d3ee 100%);
  --ra-glow: 0 8px 30px -8px rgba(139, 92, 246, .55);
  --ra-success: #10b981;
  --ra-warning: #f59e0b;
  --ra-danger: #ef4444;
  --ra-radius: 18px;
  --ra-radius-sm: 12px;
  --ra-sidebar-w: 252px;
}

[data-bs-theme="dark"] {
  --bs-body-bg: var(--ra-bg);
  --bs-body-color: var(--ra-text);
  --bs-border-color: var(--ra-border);
  --bs-secondary-color: var(--ra-muted);
  --bs-tertiary-bg: var(--ra-surface-2);
  --bs-success: var(--ra-success);
  --bs-success-rgb: 16, 185, 129;
  --bs-link-color: #a78bfa;
  --bs-link-color-rgb: 167, 139, 250;
  --bs-link-hover-color: #c4b5fd;
  --bs-link-hover-color-rgb: 196, 181, 253;
}

html { scrollbar-color: #2a2d38 transparent; }
body {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: .925rem; letter-spacing: -.005em;
  background:
    radial-gradient(1100px 620px at 12% -12%, rgba(139, 92, 246, .16), transparent 62%),
    radial-gradient(900px 520px at 100% -5%, rgba(34, 211, 238, .09), transparent 60%),
    var(--ra-bg);
  background-attachment: fixed;
}
::selection { background: rgba(139, 92, 246, .45); }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn:hover, .ra-nav a:hover, .ra-card:hover, .dropdown-item:hover, .badge:hover, .ra-logo:hover, .page-link:hover { text-decoration: none; }
.text-muted, .text-secondary { color: var(--ra-muted) !important; }
.text-info { color: #67e8f9 !important; }
.text-grad { background: var(--ra-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.fw-600 { font-weight: 600; }
.min-w-0 { min-width: 0; }
.small-xs { font-size: .75rem; }
code, pre { color: #c4b5fd; }
h1, h2, h3, h4, h5, h6, .h5, .h6 { letter-spacing: -.02em; }

/* ---------------------------------------------------------------- layout */
.ra-sidebar {
  position: fixed; inset: .75rem auto .75rem .75rem; width: var(--ra-sidebar-w);
  background: rgba(14, 16, 22, .72); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--ra-border); border-radius: 22px;
  display: flex; flex-direction: column; z-index: 1040; transition: transform .25s ease;
}
.ra-main { margin-left: calc(var(--ra-sidebar-w) + .75rem); min-height: 100vh; }
.ra-topbar {
  position: sticky; top: 0; z-index: 1030; height: 70px;
  display: flex; align-items: center; gap: 1rem; padding: 0 2rem;
  background: rgba(7, 8, 12, .6); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--ra-border);
}
.ra-content { padding: 2rem; max-width: 1440px; }

@media (max-width: 991.98px) {
  .ra-sidebar { inset: 0 auto 0 0; border-radius: 0 22px 22px 0; transform: translateX(-105%); }
  .ra-sidebar.show { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .7); }
  .ra-main { margin-left: 0; }
  .ra-content, .ra-topbar { padding-left: 1rem; padding-right: 1rem; }
}

.ra-logo { display: flex; align-items: center; gap: .65rem; font-weight: 800; font-size: 1.2rem; color: var(--ra-text); text-decoration: none; letter-spacing: -.03em; }
.ra-logo-mark { width: 36px; height: 36px; border-radius: 12px; background: var(--ra-grad); display: grid; place-items: center; color: #fff; font-size: 1.05rem; box-shadow: var(--ra-glow); }
.ra-logo-img { height: 40px; width: auto; max-width: 100%; display: block; }
.ra-logo-img-lg { height: 56px; }

.ra-brand-switch .btn { background: var(--ra-surface-2); border: 1px solid var(--ra-border); color: var(--ra-text); border-radius: 12px; padding: .5rem .8rem; }
.ra-brand-switch .btn:hover { border-color: var(--ra-border-strong); }

.ra-nav { flex: 1; overflow-y: auto; padding: .5rem .75rem 1rem; scrollbar-width: thin; }
.ra-nav-label { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--ra-faint); margin: 1.25rem .85rem .45rem; }
.ra-nav a {
  position: relative; display: flex; align-items: center; gap: .7rem; padding: .55rem .85rem; border-radius: 999px;
  color: #a5aabb; text-decoration: none; font-size: .88rem; font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s;
}
.ra-nav a i { font-size: 1rem; opacity: .85; }
.ra-nav a:hover { background: var(--ra-surface-2); color: var(--ra-text); }
.ra-nav a.active {
  color: #fff; background: linear-gradient(120deg, rgba(139, 92, 246, .28), rgba(34, 211, 238, .12));
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .35);
}
.ra-nav a.active i { color: #c4b5fd; opacity: 1; }
.ra-nav a.disabled { opacity: .45; pointer-events: none; }
.ra-nav a .ra-ext { margin-left: auto; font-size: .7rem; opacity: .45; }

/* ---------------------------------------------------------------- surfaces */
.ra-card {
  position: relative; background: var(--ra-surface); border: 1px solid var(--ra-border); border-radius: var(--ra-radius);
  padding: 1.4rem 1.5rem; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 40px -24px rgba(0, 0, 0, .6);
}
a.ra-card { transition: border-color .2s, transform .2s; }
a.ra-card:hover { border-color: rgba(139, 92, 246, .45); transform: translateY(-2px); }
.ra-card-sm { padding: 1.1rem 1.2rem; }
.ra-card h2, .ra-card .h5 { font-weight: 700; }
.ra-page-title { font-weight: 800; font-size: 1.85rem; margin: 0; letter-spacing: -.035em; }
.ra-page-sub { color: var(--ra-muted); margin: .3rem 0 0; }

.ra-score-big { font-size: 3.25rem; font-weight: 800; line-height: 1; letter-spacing: -.04em; }
.ra-progress { height: 6px; background: rgba(255, 255, 255, .07); border-radius: 99px; overflow: hidden; }
.ra-progress > div { height: 100%; background: var(--ra-grad); border-radius: 99px; transition: width .6s ease; }
.ra-progress-thin { height: 4px; margin-top: .35rem; }

.ra-engine-card { position: relative; }
.ra-engine-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-size: 1rem; }
.ra-engine-card.not-connected { opacity: .55; }

.ra-stat-icon { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-size: 1.1rem; flex-shrink: 0; }
.ra-avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1px solid var(--ra-border-strong); }
.ra-avatar-initials { display: inline-grid; place-items: center; background: var(--ra-grad); color: #fff; font-weight: 700; }

/* KPI tiles (Overview) */
.ra-kpi { display: flex; flex-direction: column; gap: .35rem; height: 100%; overflow: hidden; }
.ra-kpi-label { font-size: .78rem; font-weight: 600; color: var(--ra-muted); display: flex; align-items: center; gap: .45rem; }
.ra-kpi-value { font-size: 2.2rem; font-weight: 800; letter-spacing: -.04em; line-height: 1.05; }
.ra-kpi-value small { font-size: .95rem; font-weight: 600; color: var(--ra-muted); letter-spacing: 0; }
.ra-kpi-foot { font-size: .78rem; color: var(--ra-muted); }
.ra-spark { height: 46px; margin: .35rem -.25rem -.25rem; }
.ra-kpi-hero { background: linear-gradient(135deg, rgba(139, 92, 246, .22), rgba(34, 211, 238, .07) 60%, rgba(255, 255, 255, .02)); border-color: rgba(139, 92, 246, .3); }

.pagination { --bs-pagination-bg: var(--ra-surface-2); --bs-pagination-border-color: var(--ra-border); --bs-pagination-color: var(--ra-text);
  --bs-pagination-hover-bg: var(--ra-surface-3); --bs-pagination-hover-color: var(--ra-text); --bs-pagination-hover-border-color: var(--ra-border-strong);
  --bs-pagination-active-bg: var(--ra-violet); --bs-pagination-active-border-color: var(--ra-violet); --bs-pagination-active-color: #fff;
  --bs-pagination-disabled-bg: transparent; --bs-pagination-disabled-border-color: var(--ra-border); --bs-pagination-disabled-color: var(--ra-faint);
  --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(139, 92, 246, .25); --bs-pagination-border-radius: 999px; gap: .25rem; }
.pagination .page-link { border-radius: 999px !important; min-width: 2rem; text-align: center; }

.ra-topic { border: 1px solid rgba(139, 92, 246, .28); border-radius: var(--ra-radius-sm); padding: 1.1rem 1.2rem; margin-bottom: .75rem;
  background: linear-gradient(120deg, rgba(139, 92, 246, .08), rgba(34, 211, 238, .03)); }
.ra-topic.is-done { opacity: .5; border-color: var(--ra-border); background: transparent; }
.ra-chip { display: inline-block; background: var(--ra-surface-2); border: 1px solid var(--ra-border); color: var(--ra-text); border-radius: 999px; padding: .22rem .65rem; font-size: .75rem; font-weight: 500; }
button.ra-chip { cursor: pointer; transition: border-color .15s, background .15s; }
button.ra-chip:hover { border-color: var(--ra-border-strong); background: var(--ra-surface-3); }
.ra-chip-more { color: #a78bfa; cursor: pointer; }
.ra-icon-btn { font-size: 1.05rem; width: 38px; height: 38px; display: grid !important; place-items: center; padding: 0 !important; border-radius: 999px; text-decoration: none; }
.ra-icon-btn:hover { color: var(--ra-text) !important; background: var(--ra-surface-2); }
.ra-row-link { cursor: pointer; transition: background .15s; }
.ra-row-link:hover { background: var(--ra-surface-2); }
.ra-kv { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-top: 1px solid var(--ra-border); font-size: .875rem; }
.ra-kv:first-child { border-top: 0; }
.ra-kv > span:first-child { color: var(--ra-muted); }
.ra-impersonate-bar { display: flex; align-items: center; gap: .75rem; padding: .55rem 1.5rem; background: linear-gradient(90deg, #f59e0b, #fbbf24); color: #1a1205; font-size: .85rem; margin: 0; }
.ra-log { display: flex; gap: .75rem; padding: .65rem 0; border-top: 1px solid var(--ra-border); }
.ra-log:first-child { border-top: 0; }
.ra-log-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: .45rem; flex-shrink: 0; background: var(--ra-violet); box-shadow: 0 0 0 3px rgba(139, 92, 246, .18); }
.ra-log-dot.warn { background: var(--ra-danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, .18); }

/* ---------------------------------------------------------------- controls */
.btn { border-radius: 999px; font-weight: 600; padding-left: 1.05rem; padding-right: 1.05rem; }
.btn-sm { padding-left: .8rem; padding-right: .8rem; }
.btn-link { padding-left: .4rem; padding-right: .4rem; }
.btn-grad { background: var(--ra-grad); background-size: 140% 100%; border: 0; color: #fff; box-shadow: var(--ra-glow); transition: background-position .3s, box-shadow .2s, transform .15s; }
.btn-grad:hover, .btn-grad:focus { color: #fff; background-position: 100% 0; box-shadow: 0 10px 34px -8px rgba(139, 92, 246, .75); }
.btn-grad:active { transform: translateY(1px); }
.btn-grad:disabled, .btn-grad.disabled { color: #fff; opacity: .5; box-shadow: none; }
.btn-ghost { background: var(--ra-surface-2); border: 1px solid var(--ra-border); color: var(--ra-text); }
.btn-ghost:hover, .btn-ghost:focus { border-color: var(--ra-border-strong); color: #fff; background: var(--ra-surface-3); }
.btn-dark { border-radius: 999px; }
.btn:focus-visible { box-shadow: 0 0 0 .2rem rgba(139, 92, 246, .45); }

.form-control, .form-select { background-color: var(--ra-surface-2); border-color: var(--ra-border); color: var(--ra-text); border-radius: var(--ra-radius-sm); padding: .6rem .9rem; }
.form-select { padding-right: 2.4rem; }   /* room for the caret */
.form-control-sm { padding: .4rem .75rem; border-radius: 10px; }
.form-control:focus, .form-select:focus { background-color: var(--ra-surface-3); border-color: rgba(139, 92, 246, .7); box-shadow: 0 0 0 .22rem rgba(139, 92, 246, .2); color: var(--ra-text); }
.form-control::placeholder { color: var(--ra-faint); }
.form-control:disabled { background-color: rgba(255, 255, 255, .02); color: var(--ra-muted); }
.form-select option { background: var(--ra-surface-solid); }
.form-label { color: #c9cddb; }
.form-check-input { background-color: var(--ra-surface-3); border-color: var(--ra-border-strong); }
.form-check-input:checked, .form-switch .form-check-input:checked { background-color: var(--ra-violet); border-color: var(--ra-violet); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(139, 92, 246, .25); border-color: rgba(139, 92, 246, .7); }
.input-group > .btn { border-radius: 0; }
.input-group > :first-child { border-top-left-radius: var(--ra-radius-sm); border-bottom-left-radius: var(--ra-radius-sm); }
.input-group > :last-child { border-top-right-radius: 999px; border-bottom-right-radius: 999px; }

.ra-tabs { display: inline-flex; gap: .25rem; background: rgba(255, 255, 255, .04); border: 1px solid var(--ra-border); border-radius: 999px; padding: .3rem; flex-wrap: wrap; }
.ra-tabs button { border: 0; background: transparent; color: var(--ra-muted); padding: .4rem .95rem; border-radius: 999px; font-size: .85rem; font-weight: 600; transition: color .15s, background .15s; }
.ra-tabs button:hover { color: var(--ra-text); }
.ra-tabs button.active { background: var(--ra-surface-3); color: #fff; box-shadow: inset 0 0 0 1px var(--ra-border-strong); }

.badge { border-radius: 999px; font-weight: 600; padding: .38em .7em; }
.badge-cat { background: var(--ra-surface-2); color: #c9cddb; border: 1px solid var(--ra-border); }
.badge-cat.visibility { background: rgba(139, 92, 246, .18); color: #c4b5fd; border-color: transparent; }
.badge-soft-success { background: rgba(16, 185, 129, .15); color: #34d399; }
.badge-soft-warning { background: rgba(245, 158, 11, .15); color: #fbbf24; }
.badge-soft-danger { background: rgba(239, 68, 68, .15); color: #f87171; }
.badge-soft-info { background: rgba(139, 92, 246, .18); color: #c4b5fd; }

.alert { border-radius: var(--ra-radius-sm); border-width: 1px; backdrop-filter: blur(10px); }
.alert-warning { background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .3); color: #fcd34d; }
.alert-info { background: rgba(139, 92, 246, .1); border-color: rgba(139, 92, 246, .3); color: #ddd6fe; }
.alert-danger { background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .3); color: #fca5a5; }
.alert-link { color: inherit; }

.table { --bs-table-bg: transparent; --bs-table-color: var(--ra-text); }
.table thead th { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ra-faint); }
.border-top, .border-bottom { border-color: var(--ra-border) !important; }

/* ---------------------------------------------------------------- lists */
.ra-row { border: 1px solid var(--ra-border); border-radius: var(--ra-radius-sm); padding: .95rem 1.15rem; background: rgba(255, 255, 255, .025); transition: border-color .15s, background .15s; }
.ra-row + .ra-row { margin-top: .6rem; }
.ra-row:hover { border-color: var(--ra-border-strong); }
.ra-row.sev-critical { background: rgba(239, 68, 68, .06); border-color: rgba(239, 68, 68, .25); }
.ra-row.sev-warning { background: rgba(245, 158, 11, .06); border-color: rgba(245, 158, 11, .25); }
.ra-row.sev-passed { background: rgba(16, 185, 129, .05); border-color: rgba(16, 185, 129, .2); }
.ra-row.inactive { opacity: .5; }
.ra-result { cursor: pointer; }
.ra-result:hover { background: rgba(255, 255, 255, .05); }

.ra-code { background: rgba(0, 0, 0, .45); border: 1px solid var(--ra-border); border-radius: var(--ra-radius-sm); padding: 1rem; font-size: .8rem; max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-word; color: #d4d7e3; font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }

.ra-empty { text-align: center; padding: 3rem 1rem; color: var(--ra-muted); }
.ra-empty i { font-size: 2.2rem; display: block; margin-bottom: .6rem; background: var(--ra-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.ra-answer { white-space: pre-wrap; font-size: .88rem; line-height: 1.6; max-height: 60vh; overflow: auto; }
.ra-answer mark { background: rgba(139, 92, 246, .35); color: #fff; padding: 0 .15rem; border-radius: 4px; }

/* ---------------------------------------------------------------- toasts, modals, dropdowns */
.toast { background: rgba(18, 20, 28, .92); backdrop-filter: blur(14px); border: 1px solid var(--ra-border-strong); color: var(--ra-text); border-radius: 14px; box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .7); }
.modal-backdrop.show { opacity: .7; }
.modal-content { background: var(--ra-surface-solid); border: 1px solid var(--ra-border-strong); border-radius: 22px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8); }
.modal-header, .modal-footer { border-color: var(--ra-border); padding: 1.1rem 1.4rem; }
.modal-body { padding: 1.4rem; }
.modal-title { font-weight: 700; letter-spacing: -.02em; }
.dropdown-menu { background: var(--ra-surface-solid); border: 1px solid var(--ra-border-strong); border-radius: 16px; padding: .4rem; box-shadow: 0 24px 50px -16px rgba(0, 0, 0, .8); }
.dropdown-item { border-radius: 10px; padding: .5rem .75rem; color: var(--ra-text); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--ra-surface-2); color: #fff; }
.dropdown-item.active, .dropdown-item:active { background: rgba(139, 92, 246, .25); color: #fff; }
.dropdown-divider { border-color: var(--ra-border); }

/* ---------------------------------------------------------------- auth + onboarding */
.ra-auth-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem;
  background:
    radial-gradient(640px 420px at 25% 40%, rgba(139, 92, 246, .22), transparent 70%),
    radial-gradient(600px 420px at 78% 60%, rgba(34, 211, 238, .13), transparent 70%),
    var(--ra-bg);
}
.ra-auth-card { width: 100%; max-width: 440px; }
.ra-onb-card { width: 100%; max-width: 520px; }
.ra-input-icon { position: relative; }
.ra-input-icon > i { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); color: var(--ra-faint); pointer-events: none; }
.ra-input-icon > .form-control { padding-left: 2.6rem; }

.ra-steps { display: flex; align-items: center; justify-content: center; margin-bottom: 1.75rem; }
.ra-step { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--ra-surface-2); color: var(--ra-faint); border: 1px solid var(--ra-border); transition: all .2s; }
.ra-step.done, .ra-step.current { background: var(--ra-grad); color: #fff; border-color: transparent; box-shadow: var(--ra-glow); }
.ra-step-line { width: 44px; height: 2px; background: var(--ra-border); transition: background .2s; }
.ra-step-line.done { background: var(--ra-grad); }

.ra-tips { background: rgba(255, 255, 255, .03); border: 1px solid var(--ra-border); border-radius: var(--ra-radius-sm); padding: 1rem 1.1rem; font-size: .82rem; }
.ra-summary li { padding: .2rem 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
