:root {
    --rq-primary: #4f46e5;
    --rq-primary-dark: #3730a3;
    --rq-bg: #f5f7fb;
    --rq-sidebar: #111827;
    --rq-sidebar-soft: #1f2937;
    --rq-border: #e5e7eb;
    --rq-text: #111827;
    --rq-muted: #6b7280;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--rq-bg); color: var(--rq-text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.btn-primary { --bs-btn-bg: var(--rq-primary); --bs-btn-border-color: var(--rq-primary); --bs-btn-hover-bg: var(--rq-primary-dark); --bs-btn-hover-border-color: var(--rq-primary-dark); }
.form-control:focus,.form-select:focus { border-color: rgba(79,70,229,.55); box-shadow: 0 0 0 .25rem rgba(79,70,229,.12); }

.login-body { min-height: 100vh; background: radial-gradient(circle at 10% 10%, rgba(79,70,229,.18), transparent 32%), radial-gradient(circle at 90% 85%, rgba(14,165,233,.15), transparent 30%), #f7f8fc; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(440px, 100%); background: rgba(255,255,255,.95); border-radius: 24px; padding: 40px; border: 1px solid rgba(255,255,255,.6); }
.login-brand,.sidebar-brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: linear-gradient(135deg,#6366f1,#4338ca); color: #fff; font-weight: 800; letter-spacing: -.5px; box-shadow: 0 8px 18px rgba(79,70,229,.26); }
.brand-title { font-size: 1.18rem; font-weight: 800; letter-spacing: -.4px; }

.app-loading { position: fixed; inset: 0; display: grid; place-content: center; gap: 12px; text-align: center; color: var(--rq-muted); background: var(--rq-bg); z-index: 9999; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; background: var(--rq-sidebar); color: #fff; padding: 22px 16px; display: flex; flex-direction: column; z-index: 1030; transition: transform .25s ease; }
.sidebar-brand { padding: 0 8px 22px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand small { color: #94a3b8; }
.sidebar-nav { display: grid; gap: 6px; margin-top: 20px; }
.nav-item { border: 0; background: transparent; color: #cbd5e1; display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 11px; text-align: left; font-weight: 600; transition: .18s ease; }
.nav-item i { font-size: 1.05rem; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { background: linear-gradient(135deg, rgba(99,102,241,.95), rgba(67,56,202,.95)); color: #fff; box-shadow: 0 8px 20px rgba(0,0,0,.18); }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding: 18px 8px 0; }
.user-mini { display: flex; align-items: center; gap: 10px; }
.avatar { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.12); font-weight: 800; }
.min-w-0 { min-width: 0; }

.main-content { margin-left: 260px; min-height: 100vh; }
.topbar { min-height: 82px; padding: 18px 28px; background: rgba(255,255,255,.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--rq-border); display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 1020; }
.page-title { font-size: 1.35rem; margin: 0; font-weight: 800; letter-spacing: -.3px; }
.page-subtitle { color: var(--rq-muted); font-size: .9rem; }
.content-section { display: none; padding: 24px 28px 40px; }
.content-section.active { display: block; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.stat-card { background: #fff; border: 1px solid var(--rq-border); border-radius: 16px; padding: 20px; display: flex; align-items: center; gap: 15px; box-shadow: 0 4px 14px rgba(15,23,42,.04); }
.stat-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem; background: #eef2ff; color: var(--rq-primary); }
.stat-label { color: var(--rq-muted); font-size: .86rem; }
.stat-value { font-size: 1.65rem; font-weight: 800; line-height: 1.1; }
.panel { background: #fff; border: 1px solid var(--rq-border); border-radius: 16px; overflow: hidden; box-shadow: 0 4px 14px rgba(15,23,42,.04); }
.panel-header { padding: 18px 20px; border-bottom: 1px solid var(--rq-border); }
.panel-header h2,.section-toolbar h2 { margin: 0; font-size: 1.08rem; font-weight: 800; }
.panel-body { padding: 20px; }
.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-toolbar p { margin: 4px 0 0; color: var(--rq-muted); }
.table { --bs-table-bg: transparent; }
.table thead th { background: #f8fafc; color: #64748b; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; padding: 13px 16px; border-bottom-width: 1px; white-space: nowrap; }
.table tbody td { padding: 14px 16px; border-color: #eef2f7; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.empty-state { padding: 42px 20px; text-align: center; color: var(--rq-muted); }
.result-row { display: grid; grid-template-columns: 92px minmax(0,1fr) 45px; gap: 12px; align-items: center; margin-bottom: 13px; }
.result-row:last-child { margin-bottom: 0; }
.result-bar { height: 9px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.result-fill { height: 100%; border-radius: inherit; }
.bg-passed { background: #22c55e; }.bg-failed { background: #ef4444; }.bg-blocked { background: #f59e0b; }.bg-skipped { background: #8b5cf6; }.bg-not-run { background: #94a3b8; }
.badge-priority-low { background:#ecfdf5;color:#047857; }.badge-priority-medium { background:#eff6ff;color:#1d4ed8; }.badge-priority-high { background:#fff7ed;color:#c2410c; }.badge-priority-critical { background:#fef2f2;color:#b91c1c; }
.status-dot { display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:6px; }
.status-active { background:#22c55e; }.status-archived,.status-inactive { background:#94a3b8; }.status-draft,.status-not_started { background:#f59e0b; }.status-in_progress { background:#3b82f6; }.status-completed { background:#22c55e; }.status-cancelled { background:#ef4444; }
.case-selector { max-height: 300px; overflow: auto; border: 1px solid var(--rq-border); border-radius: 12px; padding: 10px; }
.case-selector .form-check { padding: 9px 10px 9px 34px; border-radius: 8px; }
.case-selector .form-check:hover { background: #f8fafc; }
.step-row { border: 1px solid var(--rq-border); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: #fbfdff; }
.run-case-card { border: 1px solid var(--rq-border); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.run-case-card:last-child { margin-bottom:0; }
.run-case-head { display:flex; justify-content:space-between; gap:12px; margin-bottom:12px; }
.progress { height: 8px; background: #eef2f7; }

@media (max-width: 1199.98px) { .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); box-shadow: 20px 0 40px rgba(15,23,42,.25); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .topbar { padding: 15px 18px; }
    .content-section { padding: 20px 16px 32px; }
}
@media (max-width: 575.98px) {
    .stats-grid { grid-template-columns: 1fr; }
    .section-toolbar { align-items: stretch; flex-direction: column; }
    .section-toolbar .btn { width: 100%; }
    .login-panel { padding: 28px 22px; }
}

@media print {
    .sidebar,.topbar,.section-toolbar .btn,#globalAlert { display:none !important; }
    .main-content { margin-left:0; }
    .content-section { display:none !important; padding:0; }
    #section-reports { display:block !important; }
    body { background:#fff; }
    .panel { box-shadow:none; border:0; }
}
