:root {
    --bp-navy: #1a2744;
    --bp-dark-navy: #0f1a2e;
    --bp-navy-2: #2a3350;
    --bp-gold: #c9a84c;
    --bp-gold-light: #d4b86a;
    --bp-fog: #f5f4f0;
    --bp-page: #f5f4f0;
    --bp-surface: #ffffff;
    --bp-surface-2: #fbfaf7;
    --bp-border: #d9dde5;
    --bp-rule: #2e3d5e;
    --bp-text: #111111;
    --bp-muted: #6b7280;
    --bp-soft: #8a9099;
    --bp-positive: #15803d;
    --bp-caution: #ca8a04;
    --bp-alert: #dc2626;
    --bp-sidebar: 240px;
    --bp-radius: 4px;
    --bp-font: "Avenir Next", Avenir, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --bp-shadow: 0 18px 60px rgba(26, 39, 68, 0.12);
    color-scheme: light;
}

html[data-portal-theme="dark"] {
    --bp-page: #0f1a2e;
    --bp-surface: #1f2942;
    --bp-surface-2: #17233b;
    --bp-border: #2e3d5e;
    --bp-text: #f5f4f0;
    --bp-muted: #c5c8ce;
    --bp-soft: #8a9099;
    --bp-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
}

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

html {
    min-height: 100%;
}

body.beneath-portal {
    min-height: 100%;
    margin: 0;
    color: var(--bp-text);
    background: var(--bp-page);
    font-family: var(--bp-font);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

.portal-shell {
    display: flex;
    min-height: 100vh;
}

.portal-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
    display: flex;
    width: var(--bp-sidebar);
    flex-direction: column;
    overflow: hidden;
    background: var(--bp-dark-navy);
    color: #ffffff;
}

.portal-wordmark {
    padding: 24px 20px 0;
}

.portal-wordmark__brand,
.portal-wordmark__product {
    display: block;
}

.portal-wordmark__brand {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.portal-wordmark__product {
    margin-top: 2px;
    color: var(--bp-soft);
    font-size: 12px;
}

.portal-nav {
    flex: 1;
    overflow-y: auto;
    padding-top: 20px;
}

.portal-nav__section {
    margin: 0 0 8px;
}

.portal-nav__label {
    margin: 0;
    padding: 16px 20px 4px;
    color: var(--bp-soft);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.2;
    text-transform: uppercase;
}

.portal-nav__item {
    display: flex;
    min-height: 40px;
    align-items: center;
    border-left: 3px solid transparent;
    padding: 0 16px;
    color: #ffffff;
    font-size: 13px;
    text-decoration: none;
}

.portal-nav__item:hover,
.portal-nav__item:focus {
    background: rgba(255, 255, 255, 0.06);
    outline: none;
}

.portal-user {
    display: flex;
    gap: 10px;
    align-items: center;
    border-top: 1px solid var(--bp-navy-2);
    padding: 16px;
}

.portal-theme-toggle {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(138, 144, 153, 0.45);
    border-radius: var(--bp-radius);
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 0 9px;
}

.portal-theme-toggle:hover,
.portal-theme-toggle:focus {
    border-color: var(--bp-gold);
    outline: none;
}

.portal-user__avatar {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    border-radius: 50%;
    background: var(--bp-gold);
    color: var(--bp-navy);
    font-size: 12px;
    font-weight: 700;
}

.portal-user__meta {
    display: grid;
    min-width: 0;
    gap: 2px;
    font-size: 13px;
}

.portal-user__meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-user__meta a {
    color: var(--bp-soft);
    font-size: 12px;
    text-decoration: none;
}

.portal-user__meta span + span {
    color: var(--bp-soft);
    font-size: 12px;
}

.portal-main {
    width: calc(100% - var(--bp-sidebar));
    min-height: 100vh;
    margin-left: var(--bp-sidebar);
}

.portal-page {
    padding: 24px;
}

.portal-page__header,
.portal-panel__header {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
}

.portal-page__header {
    margin-bottom: 20px;
}

.portal-page__header h1,
.portal-panel__header h2,
.portal-empty h3,
.portal-content h1,
.portal-content h2,
.portal-content h3 {
    margin: 0;
    color: var(--bp-text);
    letter-spacing: 0;
}

.portal-page__header h1 {
    font-size: 22px;
    line-height: 1.2;
}

.portal-template-debug {
    display: inline-flex;
    min-height: 20px;
    align-items: center;
    border: 1px solid rgba(201, 168, 76, 0.55);
    border-radius: 999px;
    margin: 8px 0 0;
    background: #fffdf6;
    color: #7c5f14;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    padding: 0 8px;
}

.portal-panel__header h2 {
    font-size: 15px;
}

.portal-empty h3 {
    font-size: 16px;
}

.portal-eyebrow {
    margin: 0 0 4px;
    color: var(--bp-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

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

.portal-button {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-surface);
    color: var(--bp-text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    padding: 0 12px;
    text-decoration: none;
}

.portal-button--primary {
    border-color: var(--bp-navy);
    background: var(--bp-navy);
    color: #ffffff;
}

.portal-button--primary:hover,
.portal-button--primary:focus {
    border-color: var(--bp-gold);
    background: var(--bp-dark-navy);
    outline: none;
}

.portal-button--full {
    width: 100%;
    margin-top: 12px;
}

.portal-login {
    display: grid;
    grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
    min-height: 100vh;
    background: var(--bp-page);
}

.portal-login__brand-panel,
.portal-login__form-panel {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 48px;
}

.portal-login__brand-panel {
    background:
        radial-gradient(circle at 50% 50%, rgba(46, 61, 94, 0.38), transparent 34%),
        var(--bp-dark-navy);
    color: var(--bp-fog);
}

.portal-login__lockup {
    display: grid;
    justify-items: center;
    gap: 22px;
    text-align: center;
}

.portal-login__wordmark {
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--bp-fog);
    font-size: clamp(34px, 4vw, 58px);
    font-weight: 800;
    letter-spacing: 0.18em;
    line-height: 1;
}

.portal-login__wordmark i {
    color: var(--bp-gold);
    font-style: normal;
    letter-spacing: 0;
}

.portal-login__lockup p {
    margin: 0;
    color: var(--bp-soft);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.24em;
    text-transform: uppercase;
}

.portal-login__form-panel {
    position: relative;
}

.portal-login__theme-toggle {
    position: absolute;
    top: 24px;
    right: 28px;
}

.portal-login__card {
    width: min(100%, 460px);
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-surface);
    box-shadow: var(--bp-shadow);
    padding: 30px;
}

.portal-login__brand {
    margin-bottom: 28px;
}

.portal-login h1 {
    margin: 0 0 16px;
    color: var(--bp-text);
    font-size: 28px;
    line-height: 1.15;
    letter-spacing: 0;
}

.portal-login__intro {
    margin: 0 0 22px;
    color: var(--bp-muted);
    font-size: 16px;
    line-height: 1.55;
}

.portal-login__form {
    display: grid;
    gap: 14px;
}

.portal-login__form label {
    display: grid;
    gap: 6px;
    color: var(--bp-muted);
    font-size: 12px;
    font-weight: 700;
}

.portal-login__form input[type="text"],
.portal-login__form input[type="password"] {
    min-height: 44px;
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-surface-2);
    color: var(--bp-text);
    font: inherit;
    padding: 0 12px;
}

.portal-login__form input[type="text"]:focus,
.portal-login__form input[type="password"]:focus {
    border-color: var(--bp-gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.18);
    outline: none;
}

.portal-login__remember {
    display: flex !important;
    grid-template-columns: none;
    gap: 8px !important;
    align-items: center;
}

.portal-login__remember input {
    margin: 0;
}

.portal-login__error {
    border: 1px solid #f0b8bd;
    border-radius: var(--bp-radius);
    margin-bottom: 16px;
    background: #fcf0f1;
    color: #8a2424;
    padding: 10px 12px;
}

.portal-login__links {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    border-top: 1px solid var(--bp-border);
    margin-top: 20px;
    padding-top: 16px;
}

.portal-login__links a {
    color: var(--bp-gold);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.portal-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.portal-metric,
.portal-panel {
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-surface);
}

.portal-metric {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
}

.portal-metric__label {
    color: var(--bp-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.portal-metric strong {
    font-size: 24px;
    line-height: 1;
}

.portal-dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
}

.portal-dashboard--secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 16px;
}

.portal-project-picker h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

.portal-project-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.portal-project-grid--wide {
    margin-top: 16px;
}

.portal-project-card {
    display: grid;
    gap: 8px;
    min-height: 96px;
    align-content: center;
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-surface-2);
    padding: 16px;
    text-decoration: none;
}

.portal-project-card.is-active {
    border-color: var(--bp-gold);
    box-shadow: inset 0 0 0 1px var(--bp-gold);
}

.portal-project-card strong {
    color: var(--bp-navy);
    font-size: 16px;
}

.portal-project-card span {
    color: var(--bp-muted);
    font-size: 13px;
}

.portal-panel {
    padding: 16px;
}

.portal-panel--wide {
    min-height: 360px;
}

.portal-status-panel {
    margin-bottom: 16px;
}

.portal-status-panel p {
    margin: 0;
}

.portal-empty {
    display: grid;
    min-height: 260px;
    place-content: center;
    gap: 8px;
    border: 1px dashed var(--bp-border);
    border-radius: var(--bp-radius);
    margin-top: 16px;
    padding: 28px;
    text-align: center;
}

.portal-empty p,
.portal-muted {
    color: var(--bp-muted);
}

.portal-empty p {
    max-width: 560px;
    margin: 0 auto;
}

.portal-badge,
.portal-pill {
    display: inline-flex;
    min-height: 20px;
    align-items: center;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.portal-badge {
    background: #eef2ff;
    color: var(--bp-navy);
    padding: 0 8px;
}

.portal-pill {
    min-width: 24px;
    justify-content: center;
    background: var(--bp-fog);
    color: var(--bp-muted);
    padding: 0 7px;
}

.portal-list {
    display: grid;
    gap: 0;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.portal-list li {
    display: flex;
    min-height: 40px;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--bp-border);
    font-size: 13px;
}

.portal-record {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 280px;
    gap: 16px;
    align-items: start;
}

.portal-record__rail {
    position: sticky;
    top: 16px;
}

.portal-record__rail h2 {
    margin: 0 0 12px;
    font-size: 15px;
}

.portal-properties {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 8px 12px;
    margin: 0;
    font-size: 13px;
}

.portal-properties dt {
    color: var(--bp-muted);
    font-weight: 700;
}

.portal-properties dd {
    min-width: 0;
    margin: 0;
}

.portal-content {
    color: var(--bp-text);
}

.portal-content > *:first-child {
    margin-top: 0;
}

.portal-content > *:last-child {
    margin-bottom: 0;
}

.portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.portal-table th,
.portal-table td {
    border-bottom: 1px solid var(--bp-border);
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
}

.portal-table th {
    color: var(--bp-muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.portal-table a {
    color: var(--bp-navy);
    font-weight: 700;
    text-decoration: none;
}

.portal-record--report {
    grid-template-columns: 300px minmax(0, 1fr) 320px;
}

.portal-record--source {
    grid-template-columns: 280px minmax(640px, 1fr) 300px;
}

.portal-record--actor {
    grid-template-columns: 280px minmax(0, 1fr) 320px;
}

.portal-widget {
    border-top: 1px solid var(--bp-border);
    margin-top: 18px;
    padding-top: 16px;
}

.portal-widget p {
    margin: 0 0 10px;
    color: #374151;
    font-size: 13px;
    line-height: 1.55;
}

.portal-action-stack {
    display: grid;
    gap: 8px;
}

.portal-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    border-bottom: 1px solid var(--bp-border);
    margin: -16px -16px 16px;
    padding: 0 16px;
}

.portal-tab {
    appearance: none;
    min-height: 44px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--bp-muted);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 0 12px;
    white-space: nowrap;
}

.portal-tab:hover,
.portal-tab:focus {
    color: var(--bp-text);
    outline: none;
}

.portal-tab.is-active {
    border-bottom-color: var(--bp-gold);
    color: var(--bp-navy);
}

.beneath-portal-ready .portal-tab-panel {
    display: none;
}

.beneath-portal-ready .portal-tab-panel.is-active {
    display: block;
}

.portal-data-note {
    margin: 0 0 12px;
    color: var(--bp-muted);
    font-size: 12px;
}

.portal-record-summary {
    border-bottom: 1px solid var(--bp-border);
    margin-bottom: 16px;
    padding-bottom: 16px;
}

.portal-record-summary p:not(.portal-eyebrow) {
    max-width: 860px;
    margin: 0;
    color: #253048;
    font-size: 15px;
    line-height: 1.6;
}

.portal-source-brief {
    display: grid;
    gap: 16px;
}

.portal-source-brief > section {
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-surface);
    padding: 16px;
}

.portal-source-brief h2 {
    margin: 0 0 10px;
    color: var(--bp-navy);
    font-size: 16px;
}

.portal-source-brief p:not(.portal-eyebrow) {
    margin: 0;
    color: #253048;
    font-size: 14px;
    line-height: 1.65;
}

.portal-bluf-panel {
    border-color: rgba(201, 168, 76, 0.45);
    background: #fffdf6;
}

.portal-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.portal-stat-grid div {
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-surface-2);
    padding: 12px;
}

.portal-stat-grid span,
.portal-mini-list span,
.portal-timeline-item time {
    display: block;
    color: var(--bp-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.portal-stat-grid strong {
    display: block;
    margin-top: 8px;
    font-size: 22px;
    line-height: 1;
}

.portal-section-title {
    margin: 18px 0 10px;
    font-size: 15px;
}

.portal-bluf-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    counter-reset: bluf;
    list-style: none;
}

.portal-bluf-list li {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-surface-2);
    padding: 14px;
    color: #253048;
    line-height: 1.55;
}

.portal-bluf-list li::before {
    counter-increment: bluf;
    content: counter(bluf, decimal-leading-zero);
    color: var(--bp-gold);
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
}

.portal-source-pages,
.portal-node-list,
.portal-distillate-groups {
    display: grid;
    gap: 12px;
}

.portal-source-page,
.portal-node-card {
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-surface);
    padding: 16px;
}

.portal-source-page h2 {
    margin: 0 0 10px;
    font-size: 14px;
}

.portal-source-page pre {
    overflow-x: auto;
    margin: 0;
    white-space: pre-wrap;
    color: #253048;
    font-family: var(--bp-font);
    font-size: 13px;
    line-height: 1.6;
}

.portal-distillate-group {
    display: grid;
    gap: 12px;
    border-top: 1px solid var(--bp-border);
    padding-top: 16px;
}

.portal-distillate-browser {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.portal-distillate-index {
    position: sticky;
    top: 16px;
    display: grid;
    gap: 6px;
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-surface-2);
    padding: 12px;
}

.portal-distillate-index a {
    display: flex;
    min-height: 30px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-radius: var(--bp-radius);
    color: var(--bp-muted);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.portal-distillate-index a:hover,
.portal-distillate-index a:focus {
    color: var(--bp-navy);
    outline: none;
}

.portal-distillate-index strong {
    color: var(--bp-navy);
}

.portal-distillate-group:first-child {
    border-top: 0;
    padding-top: 0;
}

.portal-distillate-group > header {
    display: flex;
    align-items: end;
    justify-content: space-between;
}

.portal-distillate-group h2 {
    margin: 0;
    color: var(--bp-navy);
    font-size: 14px;
}

.portal-node-card--distillate {
    display: grid;
    gap: 10px;
}

.portal-node-card--distillate header {
    display: flex;
    gap: 12px;
    align-items: start;
    justify-content: space-between;
}

.portal-node-card--distillate h3 {
    margin: 3px 0 0;
    color: var(--bp-text);
    font-size: 15px;
    line-height: 1.25;
}

.portal-node-card--distillate p {
    margin: 0;
    color: #253048;
    font-size: 13px;
    line-height: 1.55;
}

.portal-node-card--distillate footer {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    color: var(--bp-muted);
    font-size: 11px;
    font-weight: 700;
}

.portal-node-card--distillate footer span {
    border-radius: 999px;
    background: var(--bp-surface-2);
    padding: 3px 7px;
    text-transform: uppercase;
}

.portal-node-card--distillate q {
    flex-basis: 100%;
    border-left: 2px solid var(--bp-gold);
    margin-top: 2px;
    padding-left: 8px;
    color: var(--bp-muted);
    font-weight: 500;
}

.portal-node-id {
    color: var(--bp-gold);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.portal-mini-list,
.portal-mini-stack,
.portal-timeline,
.portal-card-grid {
    display: grid;
    gap: 10px;
}

.portal-mini-list article,
.portal-mini-stack article,
.portal-timeline-item,
.portal-record-card {
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-surface);
    padding: 14px;
}

.portal-mini-stack article {
    padding: 10px;
}

.portal-mini-list strong {
    display: block;
    margin-top: 4px;
    color: var(--bp-navy);
}

.portal-mini-stack span,
.portal-mini-stack a {
    display: block;
}

.portal-mini-stack span {
    color: var(--bp-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.portal-mini-stack strong,
.portal-mini-stack a {
    margin-top: 4px;
    color: var(--bp-navy);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.3;
    text-decoration: none;
}

.portal-count-list,
.portal-compact-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.portal-count-list li {
    display: flex;
    min-height: 32px;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--bp-border);
    color: var(--bp-muted);
    font-size: 12px;
    font-weight: 800;
}

.portal-count-list a {
    color: inherit;
    text-decoration: none;
}

.portal-count-list a:hover,
.portal-count-list a:focus {
    color: var(--bp-navy);
    outline: none;
    text-decoration: underline;
}

.portal-count-list li:first-child {
    border-top: 0;
}

.portal-count-list strong {
    color: var(--bp-navy);
}

.portal-compact-list {
    counter-reset: compact;
}

.portal-compact-list li {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px;
    color: #374151;
    font-size: 12px;
    line-height: 1.45;
}

.portal-compact-list li::before {
    counter-increment: compact;
    content: counter(compact);
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: 999px;
    background: var(--bp-fog);
    color: var(--bp-gold);
    font-weight: 800;
}

.portal-timeline-item {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 16px;
}

.portal-timeline-item h2,
.portal-record-card h2 {
    margin: 0;
    font-size: 15px;
    line-height: 1.3;
}

.portal-timeline-item p,
.portal-record-card p {
    margin: 6px 0 0;
    color: #374151;
    font-size: 13px;
    line-height: 1.5;
}

.portal-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-card-meta {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 6px 10px;
    border-top: 1px solid var(--bp-border);
    margin: 12px 0 0;
    padding-top: 10px;
    font-size: 12px;
}

.portal-card-meta dt {
    color: var(--bp-muted);
    font-weight: 800;
}

.portal-card-meta dd {
    min-width: 0;
    margin: 0;
}

.portal-node-card__header {
    display: flex;
    gap: 10px;
    align-items: baseline;
    margin-bottom: 8px;
}

.portal-node-card__header span {
    color: var(--bp-muted);
    font-size: 12px;
    font-weight: 800;
}

.portal-node-card__header strong {
    color: var(--bp-navy);
    font-size: 15px;
}

.portal-node-card p {
    margin: 0;
    color: #374151;
    font-size: 13px;
    line-height: 1.55;
}

.portal-node-review-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.portal-node-card--review {
    background: var(--bp-surface-2);
}

.portal-filter-form,
.portal-create-form,
.portal-review-form {
    display: grid;
    gap: 10px;
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-surface);
    padding: 12px;
}

.portal-filter-form {
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    align-items: end;
    margin-top: 14px;
}

.portal-review-form {
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    align-items: end;
    margin-top: 12px;
}

.portal-create-form {
    margin-top: 12px;
}

.portal-review-form__note {
    grid-column: 1 / -1;
}

.portal-filter-form label,
.portal-create-form label,
.portal-review-form label {
    display: grid;
    gap: 4px;
}

.portal-filter-form span,
.portal-create-form span,
.portal-review-form span {
    color: var(--bp-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.portal-filter-form select,
.portal-create-form input,
.portal-create-form textarea,
.portal-review-form select,
.portal-review-form textarea {
    width: 100%;
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: #ffffff;
    color: var(--bp-text);
    font: inherit;
    font-size: 13px;
    padding: 8px;
}

.portal-graph-panel {
    min-height: 640px;
}

.portal-graph-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.portal-network-graph {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 16px;
    margin-top: 16px;
}

.portal-network-graph svg {
    width: 100%;
    min-height: 520px;
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background:
        linear-gradient(rgba(26, 39, 68, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 39, 68, 0.035) 1px, transparent 1px),
        #ffffff;
    background-size: 28px 28px;
}

.portal-graph-edge {
    stroke: #cbd5e1;
    stroke-width: 1.2;
}

.portal-graph-node {
    cursor: pointer;
}

.portal-graph-node text {
    fill: #253048;
    font-family: var(--bp-font);
    font-size: 11px;
    font-weight: 700;
    pointer-events: none;
}

.portal-graph-node circle {
    stroke: #ffffff;
    stroke-width: 2;
}

.portal-graph-inspector {
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-surface-2);
    padding: 16px;
}

.portal-graph-inspector h2 {
    margin: 0;
    font-size: 16px;
}

.portal-readiness {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0 0;
}

.portal-readiness div,
.portal-warning {
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-surface-2);
    padding: 14px;
}

.portal-readiness dt {
    color: var(--bp-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.portal-readiness dd {
    margin: 8px 0 0;
    color: var(--bp-navy);
    font-size: 20px;
    font-weight: 800;
}

.portal-warning {
    border-color: #facc15;
    margin-top: 14px;
    background: #fefce8;
}

.portal-warning strong {
    color: #713f12;
}

.portal-warning p {
    margin: 6px 0 0;
    color: #713f12;
}

.portal-node-card blockquote {
    border-left: 3px solid var(--bp-gold);
    margin: 10px 0 0;
    padding: 6px 0 6px 12px;
    color: #4b5563;
    font-size: 13px;
    font-style: italic;
}

.portal-inline-link {
    display: inline-flex;
    margin-top: 12px;
    color: var(--bp-navy);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.portal-inline-link:hover,
.portal-inline-link:focus {
    text-decoration: underline;
}

.portal-report-body {
    overflow: hidden;
}

.portal-report-body style,
.portal-report-body script {
    display: none;
}

.portal-report-body .distil-report,
.portal-report-body .report,
.portal-report-body main {
    max-width: 100%;
}

.portal-code-value {
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 11px;
    line-height: 1.4;
}

.portal-public-main {
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(245, 244, 240, 0.24)),
        var(--bp-page);
}

.portal-public {
    display: grid;
    min-height: 100vh;
    grid-template-rows: auto 1fr auto;
    gap: 32px;
    padding: 28px;
}

.portal-public__masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.portal-public__brand .portal-wordmark__brand {
    color: var(--bp-navy);
}

.portal-public__brand .portal-wordmark__product {
    color: var(--bp-muted);
}

.portal-public__body {
    align-self: center;
    max-width: 760px;
    padding: 7vh 0;
}

.portal-public__body h1 {
    max-width: 720px;
    margin: 0;
    color: var(--bp-text);
    font-size: clamp(38px, 6vw, 68px);
    line-height: 0.98;
    letter-spacing: 0;
}

.portal-public__body p:not(.portal-eyebrow) {
    max-width: 620px;
    margin: 20px 0 0;
    color: var(--bp-muted);
    font-size: 17px;
    line-height: 1.6;
}

.portal-public__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.portal-public__cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.portal-public__cards article {
    min-height: 150px;
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-surface);
    padding: 18px;
}

.portal-public__cards span {
    display: block;
    margin-bottom: 18px;
    color: var(--bp-gold);
    font-size: 12px;
    font-weight: 800;
}

.portal-public__cards h2 {
    margin: 0;
    font-size: 15px;
}

.portal-public__cards p {
    margin: 8px 0 0;
    color: var(--bp-muted);
    font-size: 13px;
}

@media (max-width: 1080px) {
    .portal-dashboard,
    .portal-record,
    .portal-network-graph {
        grid-template-columns: 1fr;
    }

    .portal-dashboard--secondary,
    .portal-project-grid,
    .portal-distillate-browser {
        grid-template-columns: 1fr;
    }

    .portal-record__rail,
    .portal-distillate-index {
        position: static;
    }

    .portal-card-grid,
    .portal-stat-grid,
    .portal-readiness {
        grid-template-columns: 1fr 1fr;
    }

    .portal-filter-form,
    .portal-review-form {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 900px) {
    .portal-login {
        grid-template-columns: 1fr;
    }

    .portal-login__brand-panel,
    .portal-login__form-panel {
        min-height: auto;
        padding: 32px 20px;
    }

    .portal-login__brand-panel {
        min-height: 34vh;
    }

    .portal-login__form-panel {
        min-height: 66vh;
    }

    .portal-login__theme-toggle {
        top: 16px;
        right: 16px;
    }
}

@media (max-width: 760px) {
    .portal-shell {
        display: block;
    }

    .portal-sidebar {
        position: static;
        width: 100%;
        height: auto;
    }

    .portal-nav {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        padding-bottom: 12px;
    }

    .portal-user {
        display: none;
    }

    .portal-main {
        width: 100%;
        margin-left: 0;
    }

    .portal-page {
        padding: 16px;
    }

    .portal-public {
        padding: 20px;
    }

    .portal-page__header {
        align-items: flex-start;
        flex-direction: column;
    }

    .portal-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portal-card-grid,
    .portal-stat-grid,
    .portal-readiness,
    .portal-timeline-item {
        grid-template-columns: 1fr;
    }

    .portal-filter-form,
    .portal-review-form {
        grid-template-columns: 1fr;
    }

    .portal-public__cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .portal-nav {
        grid-template-columns: 1fr;
    }

    .portal-metrics {
        grid-template-columns: 1fr;
    }

    .portal-public__masthead {
        align-items: flex-start;
        flex-direction: column;
    }
}
