/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg:        #080b12;
    --bg1:       #0d1117;
    --bg2:       #111621;
    --bg3:       #161c2e;
    --border:    rgba(255,255,255,0.07);
    --border2:   rgba(255,255,255,0.12);
    --cyan:      #00e5ff;
    --violet:    #7c3aed;
    --green:     #10b981;
    --red:       #ef4444;
    --amber:     #f59e0b;
    --text:      #e2e8f0;
    --muted:     #64748b;
    --muted2:    #94a3b8;
    --font-mono: 'Space Mono', monospace;
    --font-sans: 'DM Sans', system-ui, sans-serif;
    --radius:    12px;
    --radius-sm: 8px;
    --trans:     all 0.2s ease;
    /* Risk Colors */
    --risk-critical: #ef4444;
    --risk-high:     #f97316;
    --risk-medium:   #eab308;
    --risk-low:      #22c55e;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── App Layout ───────────────────────────────────────────── */
.app-container { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────── */
aside {
    width: 248px;
    flex-shrink: 0;
    background: var(--bg1);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.brand-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--cyan), var(--violet));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
}

.brand-name {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

.brand-name em { color: var(--cyan); font-style: normal; }

nav ul { list-style: none; padding: 0 0.75rem; }
nav li { margin-bottom: 2px; }

nav a {
    color: var(--muted2);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.65rem 0.875rem;
    border-radius: var(--radius-sm);
    transition: var(--trans);
    font-size: 0.9rem;
    font-weight: 400;
}

nav a i { width: 16px; text-align: center; }

nav a:hover { color: var(--text); background: rgba(255,255,255,0.05); }

nav a.active {
    color: var(--cyan);
    background: rgba(0,229,255,0.08);
    font-weight: 500;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem;
    background: var(--bg2);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--violet), var(--cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #fff;
    flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-email { font-size: 0.8rem; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-plan { font-size: 0.72rem; color: var(--muted); }

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: var(--trans);
}

.btn-logout:hover { color: var(--red); background: rgba(239,68,68,0.08); }

/* ── Main Content ─────────────────────────────────────────── */
main {
    flex: 1;
    padding: 2rem 2.5rem;
    overflow-y: auto;
    min-width: 0;
}

/* ── Views ────────────────────────────────────────────────── */
.view { display: none; }

/* ── Auth Layout ──────────────────────────────────────────── */
.auth-view {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.auth-panel {
    width: 100%;
    max-width: 440px;
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2.5rem;
}

.auth-brand i {
    color: var(--cyan);
    font-size: 1.2rem;
}

.auth-panel h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.auth-sub {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.auth-art {
    flex: 1;
    background: var(--bg1);
    border-left: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 3rem;
}

.art-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(0,229,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,229,255,0.04) 1px, transparent 1px);
    background-size: 40px 40px;
}

.art-text {
    position: relative;
    z-index: 1;
}

.art-text h3 {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
    margin-bottom: 1rem;
}

.art-text h3 span { color: var(--cyan); }

.art-text p {
    color: var(--muted2);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.art-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.art-chips span {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 100px;
    border: 1px solid rgba(0,229,255,0.2);
    color: var(--cyan);
    background: rgba(0,229,255,0.05);
}

/* ── Form Elements ────────────────────────────────────────── */
.field { margin-bottom: 1.1rem; }

.field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.field > label, .field-header label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted2);
    margin-bottom: 0.5rem;
}

.field-header label { margin-bottom: 0; }

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap > i:first-child {
    position: absolute;
    left: 14px;
    color: var(--muted);
    font-size: 14px;
    pointer-events: none;
}

.input-wrap input {
    width: 100%;
    background: var(--bg2);
    border: 1px solid var(--border2);
    color: var(--text);
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    transition: var(--trans);
    outline: none;
    -webkit-appearance: none;
}

.input-wrap input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0,229,255,0.1);
}

.input-wrap input::placeholder { color: var(--muted); }

.toggle-pw {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    transition: var(--trans);
}

.toggle-pw:hover { color: var(--text); }

.link-subtle {
    font-size: 0.82rem;
    color: var(--muted);
    text-decoration: none;
    transition: var(--trans);
}

.link-subtle:hover { color: var(--cyan); }

/* Password strength bar */
.pw-strength {
    height: 3px;
    background: var(--bg3);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.pw-bar {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    background: var(--red);
    transition: width 0.3s ease, background 0.3s ease;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--cyan) 0%, #0091ea 100%);
    color: #050d1a;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    cursor: pointer;
    text-decoration: none;
    transition: var(--trans);
    white-space: nowrap;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0,229,255,0.25);
}

.btn-primary:active { transform: translateY(0); }

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border2);
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    font-family: var(--font-sans);
    cursor: pointer;
    text-decoration: none;
    transition: var(--trans);
}

.btn-outline:hover { border-color: var(--cyan); color: var(--cyan); }

.w-full { width: 100%; }

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--muted);
    font-size: 0.875rem;
}

.auth-switch a { color: var(--cyan); text-decoration: none; font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }

/* ── Success icon ─────────────────────────────────────────── */
.success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(16,185,129,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--green);
    margin: 0 auto 1.5rem;
}

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--text);
}

.page-sub {
    color: var(--muted);
    font-size: 0.875rem;
    margin-top: 4px;
}

.cyan-text { color: var(--cyan); }

/* ── Stats Row ────────────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--bg1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--trans);
}

.stat-card:hover { border-color: var(--border2); }

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.stat-icon.cyan { background: rgba(0,229,255,0.1); color: var(--cyan); }
.stat-icon.red { background: rgba(239,68,68,0.1); color: var(--red); }
.stat-icon.violet { background: rgba(124,58,237,0.1); color: #a78bfa; }
.stat-icon.green { background: rgba(16,185,129,0.1); color: var(--green); }

.stat-label { font-size: 0.78rem; color: var(--muted); font-weight: 400; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text); font-family: var(--font-mono); line-height: 1.2; }
.stat-value.danger { color: var(--red); }
.stat-value.success { color: var(--green); }

.score-grade {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
    text-transform: uppercase;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
}

.grade-A { color: var(--green); border-color: var(--green); }
.grade-B { color: #84cc16; border-color: #84cc16; }
.grade-C { color: var(--amber); border-color: var(--amber); }
.grade-D { color: var(--risk-high); border-color: var(--risk-high); }
.grade-F { color: var(--red); border-color: var(--red); }

/* ── Risk Banner ────────────────────────────────────────── */
.risk-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-weight: 500;
    line-height: 1.4;
    border: 1px solid var(--border);
    animation: fadeUp 0.5s ease;
}

.risk-banner i { font-size: 1.25rem; }

.risk-banner.risk-CRITICAL {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

.risk-banner.risk-HIGH {
    background: rgba(249, 115, 22, 0.1);
    color: #fdba74;
    border-color: rgba(249, 115, 22, 0.3);
}

.risk-banner.risk-MEDIUM {
    background: rgba(234, 179, 8, 0.1);
    color: #fef08a;
    border-color: rgba(234, 179, 8, 0.3);
}

.risk-banner.risk-LOW {
    background: rgba(34, 197, 94, 0.1);
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.3);
}

/* ── Loading Skeleton ─────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    color: transparent !important;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ── Card ─────────────────────────────────────────────────── */
.card {
    background: var(--bg1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i { color: var(--cyan); }

/* ── Table ────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0 0 0.75rem;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-completed { background: rgba(16,185,129,0.1); color: var(--green); }
.badge-running   { background: rgba(0,229,255,0.1); color: var(--cyan); }
.badge-pending   { background: rgba(245,158,11,0.1); color: var(--amber); }
.badge-failed    { background: rgba(239,68,68,0.1); color: var(--red); }
.badge-critical  { background: rgba(239,68,68,0.1); color: var(--red); }
.badge-high      { background: rgba(245,158,11,0.12); color: var(--amber); }
.badge-medium    { background: rgba(0,229,255,0.08); color: var(--cyan); }
.badge-low       { background: rgba(16,185,129,0.1); color: var(--green); }
.badge-info      { background: rgba(148,163,184,0.1); color: var(--muted2); }

/* ── Scan Layout ──────────────────────────────────────────── */
.scan-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.25rem;
}

.scan-profiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.profile-opt {
    position: relative;
    cursor: pointer;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    text-align: center;
    transition: var(--trans);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-opt input { position: absolute; opacity: 0; pointer-events: none; }

.profile-opt:hover { border-color: rgba(0,229,255,0.3); }

.profile-opt.active {
    border-color: var(--cyan);
    background: rgba(0,229,255,0.06);
}

.profile-name { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.profile-desc { font-size: 0.72rem; color: var(--muted); }

.code-input {
    width: 100%;
    background: var(--bg2);
    border: 1px solid var(--border2);
    color: var(--cyan);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-family: var(--font-mono);
    resize: vertical;
    min-height: 90px;
    outline: none;
    transition: var(--trans);
}

.code-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,229,255,0.08); }
.code-input::placeholder { color: var(--muted); }

.optional { font-size: 0.72rem; color: var(--muted); font-weight: 400; }

.module-list { display: flex; flex-direction: column; gap: 6px; }

.module-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--bg2);
    font-size: 0.85rem;
    color: var(--muted2);
    border: 1px solid var(--border);
}

.module-item.active { color: var(--text); }
.module-item i:first-child { width: 16px; text-align: center; color: var(--cyan); }
.module-item .check { margin-left: auto; color: var(--green); font-size: 0.75rem; }

/* ── Vuln Cards ───────────────────────────────────────────── */
.vuln-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    background: var(--bg2);
    border-left: 3px solid var(--red);
    transition: var(--trans);
}

.vuln-card:hover { border-color: var(--border2); }
.vuln-card.high   { border-left-color: var(--amber); }
.vuln-card.medium { border-left-color: var(--cyan); }
.vuln-card.low    { border-left-color: var(--green); }
.vuln-card.info   { border-left-color: var(--muted); }

.vuln-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.vuln-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.vuln-endpoint { font-family: var(--font-mono); font-size: 0.78rem; color: var(--cyan); margin-bottom: 0.75rem; }
.vuln-desc { font-size: 0.875rem; color: var(--muted2); line-height: 1.6; margin-bottom: 0.75rem; }
.vuln-fix-label { font-size: 0.75rem; font-weight: 600; color: var(--green); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.vuln-fix { font-size: 0.85rem; color: var(--muted2); line-height: 1.5; }

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
}

.empty-state i { font-size: 2rem; margin-bottom: 1rem; display: block; }
.empty-state p { font-size: 0.9rem; }
.empty-state a { color: var(--cyan); text-decoration: none; }

/* ── Toast ────────────────────────────────────────────────── */
.toast {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text);
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 9999;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    max-width: 340px;
}

.toast.show { display: flex; }
.toast.success { border-color: rgba(16,185,129,0.3); }
.toast.error   { border-color: rgba(239,68,68,0.3); }
.toast i { font-size: 15px; }
.toast.success i { color: var(--green); }
.toast.error i   { color: var(--red); }

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeUp 0.4s ease forwards; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .scan-layout { grid-template-columns: 1fr; }
    .auth-art { display: none; }
    .auth-panel { max-width: 100%; }
}

@media (max-width: 768px) {
    main { padding: 1.25rem; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .scan-profiles { grid-template-columns: repeat(2, 1fr); }
}

/* ── Billing ─────────────────────────────────────────────────────────────── */
.billing-current {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.billing-plan-badge {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: var(--primary);
}
.billing-plan-name { font-size: 1.1rem; font-weight: 600; display: block; }
.billing-quota { font-size: 0.82rem; color: var(--text-muted); display: block; margin-top: 2px; }
.billing-usage-bar {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.billing-usage-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 99px;
  transition: width 0.4s ease;
}
.billing-plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}
.billing-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  position: relative;
  transition: border-color 0.2s;
}
.billing-card-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.billing-current-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #000;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.billing-card h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.4rem; }
.billing-price { font-size: 1.6rem; font-weight: 700; color: var(--primary); margin-bottom: 1rem; }
.billing-features { list-style: none; padding: 
