@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

:root {
    color-scheme: dark;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --bg: #030712;
    --bg-soft: #0f172a;
    --surface: rgba(13, 24, 46, 0.95);
    --surface-alt: rgba(15, 23, 42, 0.65);
    --border: rgba(148, 163, 184, 0.2);
    --muted: #93adc7;
    --text: #f8fafc;
    --accent: #38bdf8;
}

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

body {
    margin: 0;
    font-family: inherit;
    background: radial-gradient(circle at top, rgba(56, 189, 248, 0.18), transparent 45%), var(--bg);
    color: var(--text);
    min-height: 100vh;
    letter-spacing: 0.01em;
}

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

a:hover {
    color: var(--accent);
}

button {
    font-family: inherit;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.surface {
    background: var(--surface);
    border-radius: 1.25rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 20px 45px rgba(2, 6, 23, 0.45);
}

.eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--muted);
    margin: 0;
}

.ghost-pill,
.primary-pill {
    border-radius: 999px;
    padding: 0.5rem 1.1rem;
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid transparent;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    font-size: 0.85rem;
}

.ghost-pill.small {
    padding: 0.35rem 0.9rem;
    font-size: 0.75rem;
}

.ghost-pill:hover {
    background: rgba(148, 163, 184, 0.25);
}

.ghost-pill.active {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.6);
    color: var(--accent);
}

.primary-pill {
    background: linear-gradient(135deg, #38bdf8, #6366f1);
    color: #041120;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.35);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(2, 6, 23, 0.7);
}

.user-pill small {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
}

.avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #38bdf8, #34d399);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #041120;
    font-weight: 600;
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    padding-bottom: 2rem;
}

.dashboard-hero {
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
    flex-wrap: wrap;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(56, 189, 248, 0.15));
}

.dashboard-hero h1 {
    margin: 0 0 0.5rem;
}

.hero-text p {
    color: var(--muted);
    margin-top: 0;
    max-width: 40rem;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.hero-stats div {
    background: rgba(15, 23, 42, 0.65);
    border-radius: 1rem;
    padding: 1rem;
    border: 1px solid rgba(56, 189, 248, 0.15);
}

.hero-stats strong {
    font-size: 1.5rem;
}

.hero-actions {
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hero-actions .panel {
    background: rgba(2, 6, 23, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
}

.hero-actions p,
.hero-actions span {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.hero-actions strong {
    display: block;
    margin-top: 0.35rem;
    font-size: 1.4rem;
}

.detail-page .detail-hero {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(99, 102, 241, 0.12));
}

.hero-statistics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.hero-statistics strong {
    display: block;
    font-size: 1.4rem;
}

.hero-statistics small {
    color: var(--muted);
    font-size: 0.78rem;
}

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

.detail-card h3 {
    margin: 0.2rem 0;
}

.detail-heading {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.detail-status {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
}

.status-positive {
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.5);
}

.status-warning {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.5);
}

.status-critical {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.55);
}

.detail-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.detail-metrics span {
    color: var(--muted);
    font-size: 0.82rem;
}

.detail-metrics strong {
    display: block;
    font-size: 1.2rem;
}

.detail-progress {
    margin: 1rem 0 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.detail-progress.small {
    margin-top: 0.6rem;
}

.detail-notes {
    list-style: none;
    padding: 0;
    margin: 0.8rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.detail-notes.tight {
    gap: 0.2rem;
}

.pill-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.65rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
}

.metric-card {
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, var(--accent, #38bdf8), transparent 55%);
    opacity: 0.25;
    pointer-events: none;
}

.metric-heading {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--muted);
}

.metric-card h3 {
    margin: 0.8rem 0 0.4rem;
    font-size: 2rem;
}

.metric-foot {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--muted);
}

.metric-delta {
    color: #34d399;
    font-weight: 600;
}

.table-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table-card th,
.table-card td {
    text-align: left;
    padding: 0.6rem 0.3rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.table-card th {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
}

.line-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

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

.line-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.8rem;
    margin-top: 0.8rem;
}

.line-metrics span {
    color: var(--muted);
    font-size: 0.78rem;
}

.line-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.9rem;
}

.line-tags span {
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    font-size: 0.75rem;
}

.schedule-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.schedule-card li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

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

.meter-cluster header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.meter-tree {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.meter-tree li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 0.9rem;
    padding: 0.6rem 0.8rem;
    background: rgba(15, 23, 42, 0.55);
}

.meter-tree small {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
}

.visual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.chart-card header,
.lines-card header,
.health-card header,
.attention-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.sparkline {
    display: flex;
    align-items: flex-end;
    height: 180px;
    gap: 0.8rem;
}

.sparkline-bar {
    flex: 1;
    height: calc(var(--value) * 1%);
    min-height: 6px;
    border-radius: 0.75rem 0.75rem 0.35rem 0.35rem;
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.28), rgba(56, 189, 248, 0.05));
    border: 1px solid rgba(56, 189, 248, 0.3);
    position: relative;
}

.sparkline-bar strong {
    position: absolute;
    top: -1.5rem;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sparkline-bar span {
    position: absolute;
    bottom: -1.8rem;
    font-size: 0.75rem;
    color: var(--muted);
}

.sparkline-bar:hover strong {
    opacity: 1;
}

.chart-footer {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.chart-footer div {
    min-width: 140px;
    font-size: 0.85rem;
    color: var(--muted);
}

.chart-footer strong {
    display: block;
    font-size: 1.2rem;
    margin-top: 0.25rem;
    color: var(--text);
}

.line-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.line-item {
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    display: grid;
    grid-template-columns: 1.6fr 1fr auto;
    gap: 1rem;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
}

.line-item.attention {
    border-color: rgba(248, 113, 113, 0.55);
    background: rgba(248, 113, 113, 0.08);
}

.line-text span {
    color: var(--muted);
    font-size: 0.85rem;
}

.line-meter {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
}

.progress-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(3, 7, 18, 0.8);
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #34d399, #22d3ee);
    width: calc(var(--value) * 1%);
}

.line-status {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.line-status.warning {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.6);
}

.stacked-meter {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.slice {
    flex: 1;
    border-radius: 1rem;
    padding: 1rem;
    color: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.2);
    min-width: 180px;
}

.slice small {
    display: block;
    margin-top: 0.3rem;
    color: rgba(248, 250, 252, 0.9);
}

.attention-card ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.attention-card li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.attention-card span {
    color: var(--muted);
    font-size: 0.85rem;
}

.tasks-severity {
    font-size: 0.75rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(56, 189, 248, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent);
}

@media (max-width: 960px) {
    .dashboard-hero {
        flex-direction: column;
    }

    .hero-actions {
        width: 100%;
    }

    .line-item {
        grid-template-columns: 1fr;
    }
}

#blazor-error-ui {
    background: rgba(248, 250, 252, 0.95);
    color: #0f172a;
    border: 1px solid #f87171;
    border-bottom: 0;
    box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.35);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    bottom: 0;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: 0.5rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}
