:root {
    --bg-main: #f3f6fb;
    --ink-main: #13243a;
    --ink-muted: #526277;
    --card-bg: #ffffff;
    --line-soft: #dbe3f1;
    --accent: #006c84;
    --accent-2: #0f9f9c;
    --risk: #d86f0d;
    --critical: #bd2f2f;
    --ok: #2c9152;
}

html,
body {
    margin: 0;
    font-family: "Manrope", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 15% 10%, #d5ebff 0%, rgba(213, 235, 255, 0) 40%),
        radial-gradient(circle at 95% 90%, #d7f4ef 0%, rgba(215, 244, 239, 0) 35%),
        var(--bg-main);
    color: var(--ink-main);
}

h1,
h2,
h3 {
    font-family: "Sora", "Segoe UI", sans-serif;
    letter-spacing: -0.02em;
}

a,
.btn-link {
    color: var(--accent);
    text-decoration: none;
}

a:hover,
.btn-link:hover {
    color: #00556b;
}

.content {
    padding-top: 1rem;
}

.page-intro {
    color: var(--ink-muted);
    margin-bottom: 1.2rem;
}

.grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.three-up {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.four-up {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.two-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card,
.kpi-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 4px 18px rgba(19, 36, 58, 0.06);
}

/* Stacked cards need their own gap; grids bring their own margin. */
.card {
    margin-bottom: 1rem;
}

.section-break {
    margin-top: 2.2rem;
}

/* Centred over the content area only (the sidebar is 280px on desktop). */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

@media (min-width: 641px) {
    .loading-overlay {
        left: 280px;
    }
}

.loading-box {
    width: 180px;
    height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: 0 12px 34px rgba(19, 36, 58, 0.2);
}

.loading-text {
    font-family: "Sora", "Segoe UI", sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ink-main);
}

.loading-spinner {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 4px solid rgba(19, 36, 58, 0.15);
    border-top-color: var(--accent);
    animation: loading-spin 0.9s linear infinite;
}

@keyframes loading-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .loading-spinner {
        animation-duration: 3s;
    }
}

.kpi-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
}

.kpi-value {
    font-size: 1.8rem;
    line-height: 1.1;
    margin-top: 0.3rem;
    font-weight: 800;
}

.kpi-delta {
    font-size: 0.82rem;
    color: var(--ink-muted);
    margin-top: 0.4rem;
}

.table-wrap {
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.dashboard-table th,
.dashboard-table td {
    text-align: left;
    border-bottom: 1px solid var(--line-soft);
    padding: 0.7rem 0.55rem;
    vertical-align: middle;
}

.dashboard-table th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-muted);
}

.table-title {
    font-weight: 700;
}

.table-sub {
    font-size: 0.82rem;
    color: var(--ink-muted);
}

.incident-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: flex-end;
}

.live-warning {
    color: #b4231f;
    font-weight: 600;
}

.label-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.filter-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-soft, #55617a);
    letter-spacing: 0.02em;
}

.filter-group select {
    padding: 0.5rem 0.7rem;
    border-radius: 10px;
    border: 1px solid var(--line-soft);
    background: #f6f9ff;
    font-size: 0.9rem;
    min-width: 160px;
}

.quick-actions {
    display: grid;
    gap: 0.55rem;
}

.quick-actions a {
    display: inline-block;
    padding: 0.5rem 0.65rem;
    border-radius: 10px;
    border: 1px solid var(--line-soft);
    background: #f6f9ff;
}

.tier-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.tier-essential {
    background: #e8f0ff;
    color: #28539c;
}

.tier-advanced {
    background: #dff4f1;
    color: #0f6869;
}

.tier-complete {
    background: #fff3dc;
    color: #885f14;
}

.metric-list {
    display: grid;
    gap: 0.55rem;
}

.metric-list div {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--line-soft);
    padding-bottom: 0.45rem;
}

.progress-row {
    margin-bottom: 0.75rem;
}

.progress-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.progress-track {
    width: 100%;
    height: 11px;
    background: #e8edf6;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
}

.progress-bar.identity {
    background: linear-gradient(90deg, #1876a5 0%, #17a39f 100%);
}

.progress-bar.data {
    background: linear-gradient(90deg, #2f6bc9 0%, #6d8de0 100%);
}

.severity {
    display: inline-block;
    min-width: 2.3rem;
    text-align: center;
    border-radius: 999px;
    padding: 0.2rem 0.45rem;
    font-weight: 700;
}

.severity.high {
    background: #ffe6e6;
    color: var(--critical);
}

.severity.medium {
    background: #fff1df;
    color: var(--risk);
}

.severity.low {
    background: #ecf2ff;
    color: #3159a4;
}

.capability-list {
    margin: 0;
    padding-left: 1.2rem;
    display: grid;
    gap: 0.45rem;
}

@media (max-width: 1100px) {
    .three-up,
    .four-up,
    .two-up {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .three-up,
    .four-up,
    .two-up {
        grid-template-columns: 1fr;
    }

    .dashboard-table {
        font-size: 0.85rem;
    }
}

.top-action {
    border: 1px solid var(--line-soft);
    background: #ffffff;
    color: var(--ink-main);
    padding: 0.45rem 0.8rem;
    border-radius: 9px;
    font-weight: 700;
}

.blank-layout {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.login-shell {
    width: min(480px, 100%);
}

.login-logo {
    position: fixed;
    top: 1.25rem;
    right: 1.5rem;
    width: 180px;
    height: auto;
}

@media (max-width: 600px) {
    .login-logo {
        width: 120px;
        top: 0.75rem;
        right: 0.75rem;
    }
}

.login-card {
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    padding: 1.3rem;
    box-shadow: 0 6px 30px rgba(19, 36, 58, 0.08);
    display: grid;
    gap: 0.55rem;
}

.login-card label {
    margin-top: 0.55rem;
    font-weight: 700;
}

.login-card select,
.login-card input {
    width: 100%;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    font: inherit;
}

.login-button {
    margin-top: 0.7rem;
    border: none;
    background: linear-gradient(90deg, #0f7da4 0%, #0d9688 100%);
    color: #ffffff;
    border-radius: 10px;
    padding: 0.65rem 0.8rem;
    font-weight: 700;
    display: inline-block;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.link-button {
    margin-top: 0.35rem;
    border: none;
    background: none;
    color: #0f7da4;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    text-align: left;
}

.login-error {
    color: #b33939;
    margin-top: 0.35rem;
}

.chart-wrap {
    width: 100%;
    min-height: 16rem;
}

.gap-list {
    display: grid;
    gap: 0.55rem;
}

.gap-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: #f7fbff;
}

.chart-right {
    display: flex;
    justify-content: flex-end;
}

.compact-donut {
    min-height: 14rem;
}

.suggested-grid {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.suggestion-chip {
    text-align: left;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: #f5fbff;
    color: var(--ink-main);
    padding: 0.65rem 0.75rem;
    font: inherit;
    font-weight: 600;
}

.ai-shell {
    padding-top: 0.9rem;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.7rem;
}

.assistant-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 0.28rem 0.65rem;
    background: #e4f7f3;
    color: #0f6869;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.chat-thread {
    display: grid;
    align-content: start;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 0.4rem;
}

.chat-row {
    display: flex;
}

.chat-user {
    justify-content: flex-end;
}

.chat-assistant {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: min(720px, 88%);
    border-radius: 14px;
    padding: 0.68rem 0.85rem;
    line-height: 1.42;
    font-size: 0.95rem;
    border: 1px solid var(--line-soft);
    box-shadow: 0 2px 10px rgba(19, 36, 58, 0.04);
}

.chat-user .chat-bubble {
    background: linear-gradient(120deg, #0f7da4 0%, #0d9688 100%);
    color: #ffffff;
    border-color: transparent;
}

.chat-assistant .chat-bubble {
    background: #ffffff;
    color: var(--ink-main);
}

.chat-input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.6rem;
}

.chat-input {
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    padding: 0.7rem 0.8rem;
    font: inherit;
    background: #f9fcff;
}

.chat-send {
    border: none;
    border-radius: 10px;
    padding: 0.7rem 0.95rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(90deg, #0f7da4 0%, #0d9688 100%);
    opacity: 0.6;
}

.support-banner {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
    padding: 0.85rem 1.4rem;
    margin-bottom: 1.4rem;
}

.support-banner-left {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 220px;
}

.support-banner-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    opacity: 0.75;
}

.support-banner-number {
    font-size: 1.3rem;
    font-weight: 700;
    font-family: "Sora", "Segoe UI", sans-serif;
    letter-spacing: -0.01em;
}

.support-banner-hours {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    font-size: 0.82rem;
    opacity: 0.88;
    border-left: 1px solid rgba(255, 255, 255, 0.28);
    padding-left: 1.6rem;
    margin-left: 1.6rem;
}

.support-banner-hours span strong {
    opacity: 1;
}

@media (max-width: 760px) {
    .support-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .support-banner-hours {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.28);
        padding-left: 0;
        padding-top: 0.65rem;
        margin-left: 0;
    }
}

@media (max-width: 760px) {
    .chart-right {
        justify-content: center;
    }

    .suggested-grid {
        grid-template-columns: 1fr;
    }

    .chat-bubble {
        max-width: 100%;
    }

    .chat-input-row {
        grid-template-columns: 1fr;
    }
}