:root {
  --qa-primary: #4f46e5;
  --qa-primary-dark: #3730a3;
  --qa-sidebar: #111827;
  --qa-sidebar-2: #1f2937;
  --qa-bg: #f4f6fb;
  --bs-primary: #4f46e5;
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: #4f46e5;
  --bs-link-hover-color: #3730a3;
}
body { background: var(--qa-bg); font-size: .925rem; }
.btn-primary { --bs-btn-bg: var(--qa-primary); --bs-btn-border-color: var(--qa-primary); --bs-btn-hover-bg: var(--qa-primary-dark); --bs-btn-hover-border-color: var(--qa-primary-dark); --bs-btn-active-bg: var(--qa-primary-dark); }
.btn-outline-primary { --bs-btn-color: var(--qa-primary); --bs-btn-border-color: var(--qa-primary); --bs-btn-hover-bg: var(--qa-primary); --bs-btn-hover-border-color: var(--qa-primary); }
.text-primary { color: var(--qa-primary) !important; }
.bg-primary { background-color: var(--qa-primary) !important; }

.app { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: linear-gradient(180deg, var(--qa-sidebar), var(--qa-sidebar-2)); color: #cbd5e1; display: flex; flex-direction: column; }
@media (min-width: 992px) { .sidebar { position: sticky; top: 0; height: 100vh; flex-shrink: 0; } }
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.2rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #6366f1, #06b6d4); color: #fff; display: grid; place-items: center; font-weight: 800; letter-spacing: .5px; }
.sidebar-nav { padding: .5rem .6rem 1rem; overflow-y: auto; flex: 1; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: .9rem .7rem .3rem; }
.sidebar .nav-link { color: #cbd5e1; border-radius: 8px; padding: .5rem .7rem; display: flex; gap: .65rem; align-items: center; font-size: .9rem; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active { background: rgba(99,102,241,.22); color: #fff; }
.sidebar .nav-link i { font-size: 1rem; width: 1.1rem; }
.sidebar-foot { padding: .8rem 1.2rem; border-top: 1px solid rgba(255,255,255,.06); color: #94a3b8; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: .65rem 1.25rem; background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 1020; }
.project-switch { min-width: 180px; max-width: 320px; }
.content { padding: 1.25rem; flex: 1; }
@media (min-width: 992px) { .content { padding: 1.5rem 2rem; } }
.app-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; padding: .9rem 2rem; font-size: .8rem; color: #6b7280; border-top: 1px solid #e5e7eb; background: #fff; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.page-head .sub { color: #6b7280; font-size: .875rem; }

.card { border: 1px solid #e8eaf1; border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid #eef0f5; font-weight: 600; border-radius: 12px 12px 0 0 !important; }
.kpi { padding: 1rem 1.1rem; }
.kpi .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; }
.kpi .value { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.kpi .icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; font-size: 1.2rem; }
.kpi .meta { font-size: .78rem; color: #6b7280; }

.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; font-weight: 600; background: #f9fafb; white-space: nowrap; }
.table-hover tbody tr:hover { background: #f8f9ff; }
.ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; color: #4b5563; white-space: nowrap; }
.pre { white-space: pre-wrap; }
.ai-chip { background: linear-gradient(135deg, #eef2ff, #ecfeff); color: #3730a3; border: 1px solid #c7d2fe; border-radius: 999px; padding: .1rem .5rem; font-size: .7rem; font-weight: 600; }
.score-bar { height: 6px; background: #eef0f5; border-radius: 3px; overflow: hidden; min-width: 70px; }
.score-bar > span { display: block; height: 100%; }
.cluster { border-left: 4px solid #f59e0b; }
.cluster.high { border-left-color: #dc2626; }
.empty { text-align: center; padding: 3rem 1rem; color: #6b7280; }
.empty i { font-size: 2.5rem; opacity: .5; display: block; margin-bottom: .5rem; }
.gen-hero { background: linear-gradient(135deg, #4f46e5, #0891b2); color: #fff; border-radius: 14px; padding: 1.25rem 1.5rem; }
.check-row.done { opacity: .6; }
.check-row.fail { background: #fef2f2; }
.matrix td, .matrix th { text-align: center; vertical-align: middle; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.auth-bg { background: radial-gradient(circle at 20% 20%, #e0e7ff, transparent 40%), radial-gradient(circle at 80% 0%, #cffafe, transparent 40%), #f4f6fb; min-height: 100vh; }
.spinner-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.75); display: none; place-items: center; z-index: 2000; }
.spinner-overlay.show { display: grid; }

@media print {
  .sidebar, .topbar, .app-footer, .no-print, .btn { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
  .card { border: none; box-shadow: none; }
}
