:root {
    --bg: #061014;
    --bg-panel: rgba(8, 17, 22, 0.82);
    --bg-panel-strong: rgba(7, 12, 16, 0.94);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(124, 214, 202, 0.22);
    --text: #edf7f2;
    --muted: #b7cec8;
    --muted-strong: #95b3ab;
    --aqua: #7cd6ca;
    --gold: #f2c46d;
    --coral: #ff9d88;
    --green: #7bd1a9;
    --danger-bg: rgba(81, 20, 24, 0.78);
    --caution-bg: rgba(79, 55, 11, 0.7);
    --safe-bg: rgba(13, 53, 40, 0.7);
    --radius: 28px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Space Grotesk", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(124, 214, 202, 0.2), transparent 25%),
        radial-gradient(circle at top right, rgba(242, 196, 109, 0.14), transparent 20%),
        linear-gradient(180deg, #061014 0%, #08141b 46%, #04090c 100%);
}

code {
    font-family: inherit;
    border: 1px solid rgba(124, 214, 202, 0.2);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    background: rgba(124, 214, 202, 0.08);
    color: #ddfffa;
}

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

.page-shell {
    position: relative;
    isolation: isolate;
}

.page-noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.22;
    background-image:
        linear-gradient(rgba(152, 187, 181, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(152, 187, 181, 0.08) 1px, transparent 1px);
    background-size: 30px 30px;
}

.topbar,
.hero-panel,
.summary-card,
.filter-panel,
.matrix-panel,
.dossier-panel,
.group-panel,
.peptide-card,
.flag-card,
.topic-card {
    backdrop-filter: blur(20px);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: rgba(6, 12, 16, 0.82);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-mark {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--aqua), var(--gold));
    box-shadow: 0 0 26px rgba(124, 214, 202, 0.45);
}

.topbar-links {
    display: flex;
    gap: 1.2rem;
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted-strong);
}

.layout {
    width: min(1320px, calc(100vw - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 3rem;
    display: grid;
    gap: 1.2rem;
}

.hero-panel,
.filter-panel,
.matrix-panel,
.dossier-panel {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--bg-panel);
}

.hero-panel {
    padding: 2.2rem;
}

.hero-panel::after,
.filter-panel::after,
.matrix-panel::after,
.dossier-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at top right, rgba(124, 214, 202, 0.14), transparent 28%),
        radial-gradient(circle at bottom left, rgba(242, 196, 109, 0.12), transparent 32%);
}

.eyebrow {
    font-size: 0.7rem;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--aqua);
}

.hero-panel h1,
.filter-header h2,
.section-header h2,
.group-title,
.peptide-title,
.dossier-title {
    margin: 0;
    font-family: "Fraunces", serif;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.hero-panel h1 {
    max-width: 900px;
    margin-top: 1rem;
    font-size: clamp(2.4rem, 4.8vw, 5rem);
    line-height: 1.02;
}

.hero-copy {
    max-width: 760px;
    margin: 1.1rem 0 0;
    font-size: 1.03rem;
    line-height: 1.9;
    color: var(--muted);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0.85rem 1.25rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #0f3136, #143e43);
    border-color: rgba(124, 214, 202, 0.4);
    color: #e8fffb;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.14);
    color: var(--muted);
}

.hero-note {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 1.35rem;
    color: var(--muted-strong);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
}

.live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 0 rgba(242, 196, 109, 0.6);
    animation: pulse 1.8s infinite;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.summary-card {
    padding: 1.25rem;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.25);
}

.summary-card strong {
    display: block;
    margin-top: 0.5rem;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    font-family: "Fraunces", serif;
}

.summary-label {
    font-size: 0.7rem;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--muted-strong);
}

.filter-panel,
.matrix-panel,
.dossier-panel {
    padding: 1.5rem;
}

.filter-header,
.section-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.snapshot-stamp {
    color: var(--muted-strong);
    font-size: 0.76rem;
    letter-spacing: 0.08em;
}

.filter-row {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.3rem;
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: min(380px, 100%);
    flex: 1 1 380px;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted-strong);
}

.search-field input {
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(124, 214, 202, 0.18);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font: inherit;
    letter-spacing: 0.02em;
    text-transform: none;
}

.search-field input:focus {
    outline: none;
    border-color: rgba(124, 214, 202, 0.48);
}

.chip-set {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: flex-end;
}

.chip {
    padding: 0.78rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font: inherit;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
}

.chip.is-active {
    border-color: rgba(124, 214, 202, 0.38);
    background: rgba(12, 48, 54, 0.86);
    color: #e4fffb;
}

.matrix-and-dossier {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
    gap: 1rem;
}

.matrix-groups {
    position: relative;
    z-index: 1;
    margin-top: 1.2rem;
    display: grid;
    gap: 1rem;
}

.group-panel {
    border-radius: 24px;
    border: 1px solid rgba(124, 214, 202, 0.12);
    background: rgba(4, 9, 12, 0.56);
    padding: 1rem;
}

.group-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: end;
    margin-bottom: 0.9rem;
}

.group-title {
    font-size: 1.35rem;
}

.group-count {
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted-strong);
}

.card-grid {
    display: grid;
    gap: 0.8rem;
}

.peptide-card {
    width: 100%;
    text-align: left;
    padding: 1rem;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(10, 19, 24, 0.9), rgba(6, 10, 12, 0.98));
    color: var(--text);
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease;
}

.peptide-card:hover,
.peptide-card.is-selected {
    transform: translateY(-1px);
    border-color: rgba(124, 214, 202, 0.3);
}

.peptide-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.peptide-title {
    font-size: 1.35rem;
}

.review-date {
    display: block;
    margin-top: 0.25rem;
    color: var(--muted-strong);
    font-size: 0.74rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.risk-badge,
.tag-pill,
.alias-pill,
.topic-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 999px;
    padding: 0.38rem 0.7rem;
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.risk-high {
    background: var(--danger-bg);
    border-color: rgba(255, 157, 136, 0.24);
    color: #ffd6cf;
}

.risk-moderate {
    background: var(--caution-bg);
    border-color: rgba(242, 196, 109, 0.26);
    color: #ffe9bb;
}

.risk-low {
    background: var(--safe-bg);
    border-color: rgba(123, 209, 169, 0.26);
    color: #ddffef;
}

.peptide-summary {
    margin: 0.85rem 0 0;
    color: var(--muted);
    line-height: 1.7;
    font-size: 0.94rem;
}

.tag-row,
.alias-row,
.topic-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.tag-row {
    margin-top: 0.85rem;
}

.tag-pill,
.alias-pill {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--muted-strong);
}

.dossier-content {
    position: relative;
    z-index: 1;
    margin-top: 1rem;
    display: grid;
    gap: 1rem;
}

.dossier-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dossier-title {
    font-size: 2rem;
}

.dossier-summary {
    margin-top: 0.9rem;
    color: var(--muted);
    line-height: 1.8;
}

.dossier-posture {
    padding: 1rem;
    border-radius: 22px;
    border: 1px solid rgba(124, 214, 202, 0.14);
    background: rgba(8, 24, 28, 0.82);
}

.dossier-posture h3,
.flags-panel h3,
.topics-panel h3 {
    margin: 0 0 0.65rem;
    font-size: 0.76rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--aqua);
}

.dossier-posture p,
.flags-panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.75;
}

.flags-panel,
.topics-panel {
    display: grid;
    gap: 0.75rem;
}

.flag-card,
.topic-card {
    padding: 1rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.24);
}

.flag-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted-strong);
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.flag-status {
    margin: 0.55rem 0;
    font-family: "Fraunces", serif;
    font-size: 1.2rem;
}

.topic-card h4 {
    margin: 0 0 0.75rem;
    font-size: 0.76rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--muted-strong);
}

.topic-pill {
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.topic-support {
    background: var(--safe-bg);
    border-color: rgba(123, 209, 169, 0.26);
    color: #ddffef;
}

.topic-caution {
    background: var(--caution-bg);
    border-color: rgba(242, 196, 109, 0.26);
    color: #ffe9bb;
}

.topic-blocked {
    background: var(--danger-bg);
    border-color: rgba(255, 157, 136, 0.24);
    color: #ffd6cf;
}

.empty-state {
    padding: 1rem;
    border-radius: 18px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    color: var(--muted-strong);
    line-height: 1.7;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(242, 196, 109, 0.6);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(242, 196, 109, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(242, 196, 109, 0);
    }
}

@media (max-width: 1100px) {
    .matrix-and-dossier {
        grid-template-columns: 1fr;
    }

    .dossier-panel {
        order: -1;
    }
}

@media (max-width: 900px) {
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar {
        flex-direction: column;
        gap: 0.9rem;
        align-items: flex-start;
    }

    .topbar-links {
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .layout {
        width: min(100vw - 1rem, 100%);
        padding-top: 1rem;
    }

    .hero-panel,
    .filter-panel,
    .matrix-panel,
    .dossier-panel {
        padding: 1.15rem;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .group-meta,
    .filter-header,
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-field {
        min-width: 100%;
    }
}
