* {
    box-sizing: border-box;
}

:root {
    --bg: #f6f7fb;
    --panel: #ffffff;
    --panel-soft: #fbfcff;
    --text: #1c2636;
    --muted: #58606f;
    --accent: linear-gradient(120deg, #4fb4ff 0%, #00d084 100%);
    --accent-plain: #2b8af7;
    --border: rgba(0, 29, 61, 0.08);
    --glow: 0 15px 60px rgba(43, 138, 247, 0.15);
    --radius: 16px;
}

body {
    margin: 0;
    background: radial-gradient(circle at 10% 10%, rgba(79, 180, 255, 0.08), transparent 28%),
                radial-gradient(circle at 85% 0%, rgba(0, 208, 132, 0.08), transparent 30%),
                var(--bg);
    color: var(--text);
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    line-height: 1.7;
    min-height: 100vh;
}

.hero {
    padding: 48px 7vw 24px;
    background: transparent;
    border-bottom: 1px solid var(--border);
    animation: floatDown 520ms ease forwards;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 16px;
}

.brand {
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #122138;
}

.nav-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-link {
    text-decoration: none;
    color: #3c4c66;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(0, 29, 61, 0.04);
    border: 1px solid rgba(0, 29, 61, 0.08);
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover {
    background: rgba(43, 138, 247, 0.12);
    color: #0f3258;
    transform: translateY(-1px);
}

.nav-link.active {
    background: var(--accent);
    color: #0b2436;
    box-shadow: var(--glow);
}

.hero__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.eyebrow {
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

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

.chip {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    font-size: 13px;
}

.hero__title {
    margin: 14px 0 6px;
    font-size: clamp(32px, 4vw, 48px);
    line-height: 1.15;
}

.hero__subtitle {
    margin: 0 0 20px;
    color: var(--muted);
    max-width: 720px;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
}

#search {
    flex: 1 1 320px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text);
    font-size: 16px;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.02);
}

#search::placeholder {
    color: #9ea7b7;
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
    flex: 2 1 360px;
}

#sort,
.filters select {
    padding: 14px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
}

#sort {
    flex: 0 0 200px;
}

.pill-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1 1 100%;
    margin-top: 4px;
    justify-content: flex-start;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--accent);
    color: #0b2436;
    border-radius: 999px;
    font-weight: 600;
    box-shadow: var(--glow);
}

.pill--soft {
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
    border: 1px solid var(--border);
    box-shadow: none;
}

.layout {
    padding: 28px 7vw 60px;
    display: grid;
    gap: 20px;
}

.status {
    margin: 0 7vw 16px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--muted);
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(16, 42, 96, 0.05);
}

.status--info {
    border-color: rgba(43, 138, 247, 0.2);
    background: rgba(43, 138, 247, 0.06);
    color: #0f3258;
}

.status--error {
    border-color: rgba(220, 53, 69, 0.3);
    background: rgba(220, 53, 69, 0.08);
    color: #7b1625;
}

.hidden {
    display: none;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 12px 50px rgba(16, 42, 96, 0.08);
    animation: fadeUp 520ms ease forwards;
}

.panel--primary {
    background: linear-gradient(135deg, rgba(79, 180, 255, 0.12), rgba(0, 208, 132, 0.12));
    border: 1px solid rgba(0, 29, 61, 0.08);
}

.panel--micro {
    border-left: 3px solid #2b8af7;
}

.panel--connections {
    border: 1px solid rgba(0, 29, 61, 0.12);
}

.panel__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.panel__header h2 {
    margin: 0;
    font-size: 22px;
}

.hint {
    color: var(--muted);
    margin: 0;
    font-size: 15px;
}

.story p {
    margin: 0 0 12px;
    color: var(--text);
}

.micro-action {
    margin: 0;
    color: var(--text);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.cards--index .card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--muted);
    margin-top: 12px;
}

.card {
    padding: 18px;
    border-radius: 12px;
    background: var(--panel-soft);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.2s ease, box-shadow 0.3s ease;
    opacity: 0;
    animation: floatIn 520ms ease forwards;
    animation-delay: var(--delay, 0ms);
}

.card:hover {
    transform: translateY(-6px) rotateX(1deg);
    border-color: rgba(43, 138, 247, 0.25);
    box-shadow: 0 18px 48px rgba(16, 42, 96, 0.16);
}

.card__title {
    font-weight: 700;
    margin: 0 0 8px;
    font-size: 17px;
}

.card__body {
    margin: 0 0 10px;
    color: var(--muted);
}

.card__tagline {
    font-size: 14px;
    color: #2b8af7;
}

.card__link {
    color: #0f8cff;
    text-decoration: none;
    font-weight: 700;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s ease, color 0.2s ease;
}

.card__link::after {
    content: "→";
    font-weight: 700;
    transition: transform 0.2s ease;
}

.card__link:hover {
    color: #0066ff;
    transform: translateX(2px);
}

.card__link:hover::after {
    transform: translateX(2px);
}

.card--index .card__title {
    font-size: 20px;
}

.card--index .card__body {
    color: var(--muted);
}

.connection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.connection {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    opacity: 0;
    animation: floatIn 520ms ease forwards;
    animation-delay: var(--delay, 0ms);
}

.connection__title {
    margin: 0 0 6px;
    font-weight: 600;
}

.connection__body {
    margin: 0 0 10px;
    color: var(--muted);
}

.chip-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.chip-list .chip {
    background: rgba(43, 138, 247, 0.12);
    border-color: rgba(43, 138, 247, 0.25);
    color: #1c2636;
}

.back-link {
    color: #2b8af7;
    text-decoration: none;
    font-weight: 600;
    margin-right: 8px;
}

.cards--index .card {
    border-radius: 14px;
}

.hero__title,
.panel__header h2 {
    font-weight: 700;
}

.panel__header h2 {
    color: #122138;
}

.view-toggle {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 29, 61, 0.08);
    border-radius: 10px;
    overflow: hidden;
}

.toggle-btn {
    border: none;
    background: transparent;
    padding: 10px 14px;
    font-weight: 600;
    color: #3c4c66;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.toggle-btn.active {
    background: var(--accent);
    color: #0b2436;
}

.toggle-btn:not(.active):hover {
    background: rgba(43, 138, 247, 0.12);
}

.table-wrapper {
    margin-top: 14px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 29, 61, 0.08);
    font-size: 14px;
}

.data-table th {
    background: rgba(0, 29, 61, 0.04);
    cursor: pointer;
    user-select: none;
}

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

.sorted-asc::after {
    content: "▲";
    margin-left: 6px;
    font-size: 11px;
    color: #2b8af7;
}

.sorted-desc::after {
    content: "▼";
    margin-left: 6px;
    font-size: 11px;
    color: #2b8af7;
}

.animate-stagger > * {
    opacity: 0;
    animation: floatIn 520ms ease forwards;
}

.pill,
.chip {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pill:hover,
.chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(43, 138, 247, 0.15);
}

@keyframes floatIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes floatDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 700px) {
    .hero {
        padding: 36px 20px 24px;
    }

    .layout {
        padding: 20px;
    }
}
