:root {
    --bg:        #121218;
    --bg-elev:   #1a1b22;
    --bg-soft:   #20212b;
    --surface:   #232431;
    --surface-2: #2b2d3c;
    --border:    #35374a;
    --divider:   #3c3f54;
    --text:      #e9e9f1;
    --text-dim:  #b8bbcc;
    --text-mute: #8f94a7;
    --accent:    #7c5cfc;
    --accent-2:  #9c86ff;
    --accent-3:  #c7bfff;
    --ok:        #3ccf91;
    --warn:      #f4bf4f;
    --err:       #ff6262;
    --radius:    12px;
    --radius-sm: 8px;
    --shadow-1:  0 6px 20px rgba(0,0,0,.25);
    --shadow-2:  0 12px 32px rgba(0,0,0,.35);
    --font-sans: 'Bricolage Grotesque', sans-serif;
    --font-mono: 'DM Mono', monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    min-height: 100%;
}

body {
    font-family: var(--font-sans);
    background:
        radial-gradient(1200px 800px at 80% -10%, rgba(124,92,252,.12), transparent 50%),
        radial-gradient(900px 600px at 15% 110%, rgba(60,207,145,.06), transparent 55%),
        var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

/* NAV — même base que my_account */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 0 48px;
    height: 82px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgb(18, 17, 35);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 1;
    min-width: 0;
}

.nav-logo-img {
    height: auto;
    width: 200px;
    object-fit: contain;
    display: block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
    list-style: none;
}

.nav-links a {
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-dim);
    transition: color .15s;
}

.nav-links a:hover,
.nav-links a.is-active {
    color: var(--accent-3);
}

.nav-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .75rem;
    font-weight: 700;
    color: var(--ok);
    background: rgba(60,207,145,.1);
    border: 1px solid rgba(60,207,145,.2);
    padding: 4px 10px;
    border-radius: 20px;
}

.nav-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ok);
    animation: pulse 2s infinite;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.d-inline {
    display: inline-flex;
}

/* Buttons */
.btn,
.btn-ghost,
.btn-primary,
.btn-outline-danger,
.search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    transition: all .18s ease;
}

.btn-primary,
.search-btn {
    background: linear-gradient(180deg, var(--accent-2), var(--accent));
    color: #fff;
    box-shadow: 0 6px 20px rgba(124,92,252,.28);
}

.btn-primary:hover,
.search-btn:hover {
    box-shadow: 0 8px 28px rgba(124,92,252,.48);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--accent-3);
    border-color: rgba(156,134,255,.45);
    background: rgba(124,92,252,.08);
}

.btn-outline-danger {
    background: transparent;
    color: var(--err);
    border: 1px solid rgba(255,98,98,.24);
}

.btn-outline-danger:hover {
    background: rgba(255,98,98,.08);
    border-color: rgba(255,98,98,.42);
}

.btn-sm {
    min-height: 38px;
    padding: 8px 12px;
}

/* Page */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.account-wrapper {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: calc(82px + clamp(26px, 4vw, 54px)) clamp(16px, 4vw, 40px) 60px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    animation: fadeUp .4s cubic-bezier(.4,0,.2,1) both;
}

.page-header {
    text-align: center;
    margin-bottom: 4px;
}

.page-tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--accent-2);
    background: rgba(124,92,252,.1);
    border: 1px solid rgba(124,92,252,.25);
    border-radius: 20px;
    padding: 4px 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.page-tag::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent-2);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.page-title {
    font-size: clamp(26px, 4vw, 38px);
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 6px;
}

.page-sub {
    font-size: 13px;
    color: var(--text-dim);
}

/* Toolbar */
.analyses-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: stretch;
}

.search-card,
.tabs-card,
.analyses-card,
.kpi-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
    position: relative;
    overflow: hidden;
}

.search-card::before,
.tabs-card::before,
.analyses-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--accent) 25%,
        var(--accent-2) 50%,
        var(--accent) 75%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer-line 3s ease-in-out infinite;
}

.search-card,
.tabs-card {
    padding: 14px;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all .2s ease;
}

.search-input-wrap svg {
    position: absolute;
    left: 12px;
    color: var(--text-mute);
    pointer-events: none;
}

.search-input-wrap:focus-within {
    border-color: var(--accent-2);
    box-shadow: 0 0 0 3px rgba(124,92,252,.18);
}

.search-input {
    width: 100%;
    min-height: 42px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    padding: 10px 12px 10px 36px;
    font-family: var(--font-mono);
    font-size: 12px;
}

.search-input::placeholder {
    color: var(--text-mute);
}

.tabs-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sg-tabs {
    display: inline-flex;
    gap: 7px;
    padding: 5px;
    border-radius: 999px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
}

.sg-tab-btn {
    min-height: 32px;
    padding: 6px 13px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-mute);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .75px;
    cursor: pointer;
    transition: .15s ease;
}

.sg-tab-btn:hover {
    color: var(--accent-3);
    background: rgba(124,92,252,.08);
}

.sg-tab-btn.is-active {
    color: var(--text);
    background: rgba(124,92,252,.16);
    border-color: rgba(124,92,252,.28);
}

.sg-tab-panel {
    display: none;
}

.sg-tab-panel.is-active {
    display: block;
}

/* KPI */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 10px;
}

.kpi-pill {
    box-shadow: var(--shadow-1);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-pill-label {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: .8px;
}

.kpi-pill-val {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
}

/* Cards / tables */
.analyses-card {
    min-width: 0;
    padding: 24px;
}

.analyses-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.section-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: .9px;
}

.card-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -.6px;
    margin-top: 4px;
}

.card-sub {
    color: var(--text-dim);
    font-size: 13px;
    margin-top: 4px;
}

.analyses-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
}

.analyses-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

.analyses-table-user {
    min-width: 720px;
}

.analyses-table thead {
    background: rgba(255,255,255,.025);
}

.analyses-table th {
    padding: 12px 14px;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: .9px;
    border-bottom: 1px solid var(--border);
}

.analyses-table td {
    padding: 13px 14px;
    border-bottom: 1px solid rgba(53,55,74,.68);
    vertical-align: middle;
    font-size: 13px;
    color: var(--text-dim);
}

.analyses-table tbody tr:last-child td {
    border-bottom: none;
}

.analyses-table tbody tr:hover {
    background: rgba(124,92,252,.045);
}

.sha-cell {
    display: inline-block;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text);
}

.date-cell {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-mute);
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    color: #fff;
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 800;
}

.user-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-dim);
    font-size: 12px;
}

/* Badges */
.score-badge,
.status-pill,
.detail-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 800;
}

.score-critical {
    color: var(--err);
    background: rgba(255,98,98,.1);
    border: 1px solid rgba(255,98,98,.22);
}

.score-high {
    color: var(--warn);
    background: rgba(244,191,79,.1);
    border: 1px solid rgba(244,191,79,.22);
}

.score-medium {
    color: var(--accent-3);
    background: rgba(124,92,252,.1);
    border: 1px solid rgba(124,92,252,.25);
}

.score-low {
    color: var(--ok);
    background: rgba(60,207,145,.1);
    border: 1px solid rgba(60,207,145,.22);
}

.score-empty {
    color: var(--text-mute);
    background: rgba(255,255,255,.035);
    border: 1px solid var(--border);
}

.status-done {
    color: var(--ok);
    background: rgba(60,207,145,.1);
    border: 1px solid rgba(60,207,145,.22);
}

.status-running {
    color: var(--accent-3);
    background: rgba(124,92,252,.1);
    border: 1px solid rgba(124,92,252,.25);
}

.status-error {
    color: var(--err);
    background: rgba(255,98,98,.1);
    border: 1px solid rgba(255,98,98,.22);
}

.status-pending {
    color: var(--warn);
    background: rgba(244,191,79,.1);
    border: 1px solid rgba(244,191,79,.22);
}

.status-other {
    color: var(--text-mute);
    background: rgba(255,255,255,.035);
    border: 1px solid var(--border);
}

.detail-link {
    color: var(--accent-3);
    background: rgba(124,92,252,.08);
    border: 1px solid rgba(124,92,252,.24);
    transition: all .16s;
}

.detail-link:hover {
    background: rgba(124,92,252,.14);
    border-color: rgba(156,134,255,.42);
}

.detail-link.is-disabled {
    opacity: .35;
    cursor: not-allowed;
}

/* Empty */
.empty-row td {
    padding: 42px 20px;
}

.empty-state {
    text-align: center;
}

.empty-icon {
    font-size: 30px;
    margin-bottom: 8px;
}

.empty-title {
    color: var(--text);
    font-weight: 800;
    font-size: 15px;
}

.empty-text {
    color: var(--text-mute);
    font-size: 12px;
    margin-top: 3px;
}

/* Footer */
footer {
    background: rgb(18, 17, 35);
    border-top: 1px solid var(--border);
    color: var(--text-mute);
    padding: 24px 48px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-logo {
    color: var(--text);
    font-weight: 800;
    font-size: 17px;
}

.footer-copy {
    color: var(--text-mute);
    font-family: var(--font-mono);
    font-size: 11px;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 18px;
    list-style: none;
}

.footer-links a {
    color: var(--text-mute);
    font-size: 13px;
    transition: color .15s;
}

.footer-links a:hover {
    color: var(--accent-3);
}

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

@keyframes pulse {
    0%,100% { opacity: 1; }
    50%     { opacity: .3; }
}

@keyframes shimmer-line {
    0%,100% { background-position: 0% 0; opacity: .6; }
    50%     { background-position: 100% 0; opacity: 1; }
}

/* Responsive */
@media (max-width: 1180px) {
    nav {
        padding: 0 18px;
    }

    .nav-links {
        display: none;
    }

    .analyses-toolbar {
        grid-template-columns: 1fr;
    }

    .tabs-card {
        justify-content: space-between;
    }
}

@media (max-width: 760px) {
    nav {
        height: auto;
        min-height: 82px;
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 10px;
    }

    .nav-logo-img {
        width: 145px !important;
    }

    .nav-actions {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .account-wrapper {
        padding: calc(102px + 20px) 16px 46px;
    }

    .tabs-card,
    .search-form {
        flex-direction: column;
        align-items: stretch;
    }

    .sg-tabs {
        width: 100%;
        justify-content: center;
    }

    .kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .analyses-header {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .analyses-card,
    .search-card,
    .tabs-card {
        padding: 20px;
    }

    .kpi-row {
        grid-template-columns: 1fr 1fr;
    }

    .page-title {
        font-size: 27px;
    }

    footer {
        flex-direction: column;
        text-align: center;
        align-items: center;
        padding: 24px 18px;
    }

    .footer-links {
        justify-content: center;
        flex-wrap: wrap;
    }
}