@import url("http://localhost:5601/css/portal.css");

:root {
    --ink: #0b1b2b;
    --muted: #5c6773;
    --bg: #f4f6fb;
    --card: #ffffff;
    --accent: #1f4e8f;
    --accent-strong: #163a6c;
    --shadow: 0 18px 50px rgba(12, 32, 69, 0.08);
    --radius: 16px;
    --font: "Bahnschrift", "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at 20% 0%, #e6f5ff, transparent 40%),
                radial-gradient(circle at 80% 0%, #e6eefb, transparent 45%),
                linear-gradient(180deg, #f4f6fb 0%, #eef2f7 60%, #f4f6fb 100%);
    color: var(--ink);
    font-family: var(--font);
    line-height: 1.6;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 28px 64px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.portal-shell {
    max-width: 1200px;
    margin: 22px auto 0;
    padding: 0 28px;
}

.portal-nav {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 0.9rem;
    font-weight: 600;
}

.portal-nav a {
    color: #163a6c;
    text-decoration: none;
}

.portal-nav a:hover {
    text-decoration: underline;
}

.portal-title {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-top: 12px;
    padding: 14px 16px;
}

.portal-title h1 {
    margin: 0;
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.portal-title p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.hero h1 {
    margin: 6px 0 10px;
    font-size: 2.4rem;
    letter-spacing: -0.02em;
}

.hero .lede { color: var(--muted); max-width: 800px; white-space: pre-line; }

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.28em;
    font-size: 0.75rem;
    color: var(--accent-strong);
    margin: 0;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px 22px;
}

.top-controls {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: -4px 0 -2px;
}

.btn-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    align-items: end;
}

.control {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

label { font-weight: 600; color: var(--muted); }

.help-btn {
    width: 22px;
    height: 22px;
    margin-left: 6px;
    border-radius: 999px;
    border: 1px solid rgba(11, 27, 43, 0.2);
    background: #ffffff;
    color: var(--accent-strong);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.help-btn:hover {
    background: #eef8f7;
}

.inline-help-popup {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(31, 78, 143, 0.25);
    background: #f2fbf9;
}

.inline-help-popup .muted {
    margin: 0;
}

select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d9dee8;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--ink);
    background: #fff;
}

select:focus { outline: 2px solid rgba(31, 78, 143, 0.35); }

.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 12px 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease;
}

.btn.primary {
    background: linear-gradient(120deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #fff;
    box-shadow: 0 10px 30px rgba(31, 78, 143, 0.25);
}

.btn.ghost {
    background: #0b1b2b;
    color: #f2fbf9;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn.secondary {
    background: #ffffff;
    color: var(--accent-strong);
    border: 1px solid rgba(11, 27, 43, 0.15);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn.secondary.current,
.btn.secondary[aria-current="page"] {
    background: rgba(31, 78, 143, 0.12);
    border-color: rgba(31, 78, 143, 0.35);
    color: #163a6c;
    box-shadow: inset 0 0 0 1px rgba(31, 78, 143, 0.15);
}

.btn.disabled,
.btn[aria-disabled="true"],
.btn:disabled {
    pointer-events: none;
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.btn:hover { transform: translateY(-1px); }

#loader { font-weight: 600; color: var(--muted); }

.message {
    grid-column: 1 / -1;
    padding: 10px 14px;
    border-radius: 10px;
    background: #f3f6fa;
    color: var(--muted);
    font-weight: 600;
    min-height: 24px;
}

.message.error { color: #8c1d1d; background: #fdeaea; }
.message.success { color: #0f6848; background: #e2f4ec; }

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.card-head h2 { margin: 0; }

.muted { color: var(--muted); margin: 4px 0 0; }

.table-wrapper { overflow-x: auto; }

.split-content {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr);
    gap: 16px;
    align-items: start;
}

.chart {
    min-height: 360px;
}

.impact-charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-content: start;
}

.impact-charts .chart {
    min-height: 180px;
}

#network-graph {
    min-height: 900px;
    height: 78vh;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    max-height: 1800px;
    overflow: hidden;
}

.network-section {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th, td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid #e4e8ef;
}

th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.two-line-head th {
    white-space: normal;
    line-height: 1.25;
}

tbody tr:nth-child(odd) { background: #f9fbff; }

tbody tr:hover { background: #eef5ff; }

@media (max-width: 720px) {
    .top-controls { flex-direction: column; align-items: stretch; }
    .btn-group { width: 100%; }
    .actions { flex-direction: column; align-items: stretch; }
    .btn { width: 100%; text-align: center; }
    .split-content { grid-template-columns: 1fr; }
    .chart { min-height: 320px; }
}
