:root {
    color-scheme: dark;
    --bg: #070b12;
    --bg-alt: #0d1420;
    --panel: #121a28;
    --panel-border: rgba(148, 163, 184, 0.14);
    --text: #e5eefb;
    --muted: #94a3b8;
    --primary: #38bdf8;
    --primary-strong: #0ea5e9;
    --secondary: #1e293b;
    --danger: #f87171;
    --shadow: 0 24px 80px rgba(2, 6, 23, 0.45);
    --radius: 18px;
    --container: 1120px;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    background: radial-gradient(circle at top, #102036 0%, var(--bg) 42%);
    color: var(--text);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: #7dd3fc;
}

:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid rgba(56, 189, 248, 0.85);
    outline-offset: 3px;
}

.site-main:focus {
    outline: none;
}

.site {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-main {
    flex: 1;
}

.container {
    width: min(calc(100% - 2rem), var(--container));
    margin: 0 auto;
}

.container.narrow {
    width: min(calc(100% - 2rem), 560px);
}

.container.cms {
    width: min(calc(100% - 2rem), 720px);
}

.cms-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.cms-editor-card {
    margin-top: 0.5rem;
}

.cms-editor-note {
    margin: 0 0 1.25rem;
    line-height: 1.6;
}

.cms-fieldset {
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem 0.5rem;
    margin: 0 0 1.25rem;
}

.cms-fieldset legend {
    padding: 0 0.35rem;
    color: var(--primary);
    font-weight: 600;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 6rem;
}

.form-control.mono,
.form-field .mono.form-control {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92rem;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(16px);
    background: rgba(7, 11, 18, 0.72);
    border-bottom: 1px solid var(--panel-border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 72px;
}

.header-inner > .brand {
    flex-shrink: 0;
}

.brand {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.65rem;
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.brand-icon {
    display: block;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
}

.brand-text {
    display: inline-block;
    flex: 0 1 auto;
    line-height: 1;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.site-nav a,
.site-nav button {
    color: var(--text);
}

.nav-toggle {
    display: none;
    background: transparent;
    border: 0;
    padding: 0.5rem;
}

.nav-toggle span {
    display: block;
    width: 1.4rem;
    height: 2px;
    margin: 0.3rem 0;
    background: var(--text);
}

.hero {
    padding: 5rem 0 4rem;
}

.hero-grid,
.about-grid,
.page-header,
.cta-inner,
.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
}

.hero-grid {
    align-items: center;
}

.hero-copy {
    max-width: 640px;
}

.hero-panel {
    display: grid;
    gap: 1rem;
    min-width: min(100%, 360px);
}

.stat-card,
.feature-card,
.step-card,
.auth-card,
.empty-state {
    background: rgba(18, 26, 40, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: var(--radius);
    box-shadow: 0 16px 48px rgba(2, 6, 23, 0.28);
}

.stat-card,
.feature-card,
.step-card,
.auth-card,
.empty-state {
    padding: 1.5rem;
}

.eyebrow {
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.78rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
}

h1, h2, h3 {
    line-height: 1.15;
    margin-top: 0;
}

h1 {
    font-size: clamp(2.4rem, 5vw, 4rem);
    margin-bottom: 1rem;
}

h2 {
    font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.lead,
.muted,
.auth-footer,
.detail-list dd {
    color: var(--muted);
}

.lead {
    font-size: 1.125rem;
    line-height: 1.7;
}

.hero-actions,
.card-actions,
.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header {
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 999px;
    padding: 0.8rem 1.25rem;
    border: 1px solid transparent;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #03111f;
}

.btn-secondary,
.btn-ghost {
    background: transparent;
    border-color: var(--panel-border);
    color: var(--text);
}

.btn-block {
    width: 100%;
}

.section {
    padding: 4.5rem 0;
}

.section-alt {
    background: rgba(13, 20, 32, 0.72);
}

.section-heading {
    max-width: 720px;
    margin-bottom: 2rem;
}

.card-grid,
.steps-grid,
.dashboard-grid {
    display: grid;
    gap: 1.25rem;
}

.card-grid,
.dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.steps-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.feature-card ul,
.detail-list {
    margin: 0;
    padding: 0;
}

.feature-card ul {
    padding-left: 1.1rem;
    color: var(--muted);
}

.step-number {
    color: var(--primary);
    font-weight: 700;
}

.about-grid {
    align-items: start;
}

.faq-stack {
    display: grid;
    gap: 0.75rem;
}

.faq-item {
    background: rgba(18, 26, 40, 0.72);
    border: 1px solid var(--panel-border);
    border-radius: 1rem;
    padding: 1rem 1.1rem;
}

.faq-item summary {
    cursor: pointer;
    font-weight: 600;
}

.cta-band {
    padding-bottom: 5rem;
}

.cta-inner {
    align-items: center;
    padding: 2rem;
    border-radius: calc(var(--radius) + 0.25rem);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.16), rgba(99, 102, 241, 0.16));
    border: 1px solid rgba(56, 189, 248, 0.24);
}

.auth-section {
    padding-top: 3rem;
}

.form-field {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.form-control {
    width: 100%;
    border-radius: 0.85rem;
    border: 1px solid var(--panel-border);
    background: rgba(7, 11, 18, 0.8);
    color: var(--text);
    padding: 0.85rem 1rem;
}

.alert {
    border-radius: 0.85rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fecaca;
}

.alert-success {
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.35);
    color: #bbf7d0;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    background: rgba(56, 189, 248, 0.12);
    color: #bae6fd;
    font-size: 0.82rem;
}

.badge-success {
    background: rgba(52, 211, 153, 0.12);
    color: #bbf7d0;
}

.badge-error {
    background: rgba(248, 113, 113, 0.12);
    color: #fecaca;
}

.badge-warning {
    background: rgba(251, 191, 36, 0.12);
    color: #fde68a;
}

.tenant-detail-card,
.tenant-import-card {
    margin-bottom: 1.5rem;
}

.tenant-import-card h2 {
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
}

.section-heading-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.compact-empty-state {
    padding: 1.25rem;
}

.compact-empty-state h3 {
    margin-bottom: 0.35rem;
    font-size: 1.1rem;
}

.file-input {
    padding: 0.65rem 1rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card h2.metric-value {
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    margin-bottom: 0.35rem;
}

.metrics-range {
    margin-bottom: 1.25rem;
}

.metrics-trends-card {
    margin-bottom: 1.5rem;
}

.metrics-insights-card {
    margin-bottom: 1.5rem;
}

.metrics-insights-range {
    margin-bottom: 1rem;
}

.insights-list {
    display: grid;
    gap: 0.85rem;
}

.insight-card {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 0.85rem;
    padding: 1rem 1.1rem;
    background: rgba(15, 23, 42, 0.45);
}

.insight-card h3 {
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

.insight-positive {
    border-color: rgba(52, 211, 153, 0.35);
}

.insight-negative {
    border-color: rgba(248, 113, 113, 0.35);
}

.insight-info {
    border-color: rgba(56, 189, 248, 0.25);
}

.alert-warning {
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.35);
    color: #fde68a;
}

.btn-sm {
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.sentinel-summary-card {
    margin-bottom: 1.5rem;
}

.sentinel-disclaimer {
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.sentinel-summary-result {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 0.85rem;
    padding: 1rem 1.1rem;
    background: rgba(15, 23, 42, 0.45);
    margin-bottom: 1rem;
}

.sentinel-summary-result p {
    margin: 0;
    white-space: pre-wrap;
}

.sentinel-artifact-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.sentinel-lineage-actions {
    margin-bottom: 0.75rem;
}

.lineage-panel {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 0.85rem;
    padding: 1rem 1.1rem;
    background: rgba(7, 11, 18, 0.5);
}

.lineage-fields {
    margin-bottom: 1rem;
}

.lineage-section {
    margin-top: 1rem;
}

.lineage-section p {
    margin: 0.35rem 0 0;
    white-space: pre-wrap;
}

.lineage-panel pre {
    overflow-x: auto;
    max-height: 400px;
    margin: 0.35rem 0 0;
    padding: 0.85rem 1rem;
    border-radius: 0.65rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--panel-border);
    font-size: 0.8rem;
    white-space: pre;
}

.metrics-filter {
    min-width: 180px;
    margin-bottom: 0;
}

.trend-bar-track {
    height: 0.55rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.15);
    overflow: hidden;
}

.trend-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #6366f1);
    min-width: 4px;
}

.tenant-card-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.detail-list {
    display: grid;
    gap: 1rem;
}

.detail-list dt {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.detail-list dd {
    margin: 0;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.data-table th,
.data-table td {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--panel-border);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.text-link {
    display: inline-block;
    margin-bottom: 0.75rem;
}

.site-footer {
    border-top: 1px solid var(--panel-border);
    padding: 2rem 0;
    margin-top: 2rem;
}

.footer-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.app-loading {
    min-height: 100vh;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 0.75rem;
    text-align: center;
}

.app-loading .brand {
    justify-content: center;
}

#blazor-error-ui {
    background: #451a1a;
    color: white;
    bottom: 0;
    box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.35);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

@media (max-width: 860px) {
    .hero-grid,
    .about-grid,
    .cta-inner,
    .footer-inner,
    .page-header {
        flex-direction: column;
    }

    .nav-toggle {
        display: block;
    }

    .site-nav {
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        background: rgba(7, 11, 18, 0.96);
        border-bottom: 1px solid var(--panel-border);
        display: none;
    }

    .site-nav.open {
        display: flex;
    }
}
