* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #07111f;
    --bg-alt: #0b1628;
    --surface: rgba(10, 22, 38, 0.84);
    --surface-strong: rgba(15, 29, 49, 0.94);
    --surface-soft: rgba(18, 35, 58, 0.72);
    --line: rgba(110, 231, 255, 0.16);
    --line-strong: rgba(110, 231, 255, 0.28);
    --text: #e6eef8;
    --text-muted: #95a8c2;
    --text-soft: #70839d;
    --primary: #14f195;
    --primary-dark: #0ec37a;
    --accent: #22d3ee;
    --accent-dark: #0ea5c6;
    --warning: #f59e0b;
    --danger: #fb7185;
    --critical: #ff4d6d;
    --success: #14f195;
    --shadow-lg: 0 24px 60px rgba(1, 9, 20, 0.52);
    --shadow-md: 0 16px 36px rgba(1, 9, 20, 0.32);
    --glow: 0 0 0 1px rgba(34, 211, 238, 0.12), 0 0 30px rgba(20, 241, 149, 0.08);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'IBM Plex Sans', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(34, 211, 238, 0.18), transparent 28%),
        radial-gradient(circle at 85% 12%, rgba(20, 241, 149, 0.16), transparent 26%),
        linear-gradient(135deg, #040b14 0%, #07111f 45%, #02060c 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before,
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
}

body::before {
    background-image:
        linear-gradient(rgba(109, 231, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(109, 231, 255, 0.04) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: radial-gradient(circle at center, black 35%, transparent 85%);
    z-index: -2;
}

body::after {
    background:
        radial-gradient(circle at 20% 20%, rgba(34, 211, 238, 0.1), transparent 24%),
        radial-gradient(circle at 80% 70%, rgba(20, 241, 149, 0.08), transparent 22%);
    filter: blur(24px);
    z-index: -1;
}

.container {
    min-height: 100vh;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.app-shell.app-hidden,
.auth-screen.auth-hidden {
    display: none;
}

.auth-screen {
    min-height: 100vh;
    padding: 24px;
    display: grid;
    place-items: center;
    position: relative;
    overflow: hidden;
}

.auth-corner-brand {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 2;
    pointer-events: none;
}

.brand-logo-img--corner {
    height: auto;
    width: min(320px, 44vw);
    max-height: 86px;
}

.auth-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.92;
    mix-blend-mode: screen;
}

.auth-screen::before {
    content: '';
    position: absolute;
    inset: -40%;
    background:
        radial-gradient(circle at 20% 20%, rgba(34, 211, 238, 0.22), transparent 35%),
        radial-gradient(circle at 80% 30%, rgba(20, 241, 149, 0.18), transparent 40%),
        radial-gradient(circle at 50% 85%, rgba(255, 77, 109, 0.14), transparent 42%),
        conic-gradient(from 120deg, rgba(34, 211, 238, 0.10), rgba(20, 241, 149, 0.10), rgba(34, 211, 238, 0.10));
    filter: blur(26px) saturate(1.12);
    opacity: 0.9;
    transform: translate3d(0, 0, 0);
    animation: authMotion 16s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

.auth-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(109, 231, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(109, 231, 255, 0.04) 1px, transparent 1px);
    background-size: 92px 92px;
    mask-image: radial-gradient(circle at 35% 30%, black 25%, transparent 70%);
    opacity: 0.65;
    animation: authGridDrift 18s linear infinite;
    pointer-events: none;
    z-index: 0;
}

.auth-card {
    position: relative;
    z-index: 1;
}

@keyframes authMotion {
    0% {
        transform: translate3d(-3%, -2%, 0) rotate(-2deg) scale(1.02);
    }
    50% {
        transform: translate3d(2%, 1%, 0) rotate(1deg) scale(1.06);
    }
    100% {
        transform: translate3d(5%, 3%, 0) rotate(2deg) scale(1.03);
    }
}

@keyframes authGridDrift {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        transform: translate3d(48px, 32px, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-screen::before,
    .auth-screen::after {
        animation: none !important;
    }

    .auth-canvas {
        opacity: 0.7;
        mix-blend-mode: normal;
    }
}

.auth-card {
    width: min(460px, 100%);
    padding: 2.1rem 2rem 2rem;
    border-radius: 28px;
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(9, 18, 31, 0.94), rgba(11, 23, 39, 0.86));
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.9rem;
    margin-bottom: 1.6rem;
}

.auth-logo-shell {
    flex-shrink: 0;
    width: 220px;
    height: 80px;
}

.auth-copy h1 {
    margin-bottom: 0.4rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.45rem, 1.8vw, 1.9rem);
    line-height: 1.12;
    color: #f8fbff;
}

.auth-copy p {
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 44ch;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 600;
}

.auth-input {
    min-height: 48px;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(110, 231, 255, 0.14);
    background: rgba(6, 14, 26, 0.92);
    color: var(--text);
    font: inherit;
}

.auth-input:focus {
    outline: none;
    border-color: rgba(20, 241, 149, 0.42);
    box-shadow: 0 0 0 3px rgba(20, 241, 149, 0.08);
}

.auth-error {
    min-height: 1.2rem;
    color: #ff9bad;
    font-size: 0.9rem;
}

.auth-submit,
.logout-btn {
    min-height: 46px;
    padding: 0.8rem 1rem;
    border: 1px solid transparent;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: #031019;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(20, 241, 149, 0.16);
}

.logout-btn {
    background: rgba(7, 17, 31, 0.9);
    color: var(--text);
    border-color: rgba(110, 231, 255, 0.16);
    box-shadow: none;
}

.logout-btn:hover {
    border-color: rgba(34, 211, 238, 0.32);
    color: var(--accent);
}

.header,
.stats-grid,
.sidebar,
.overview-card,
.list-item,
.scenario-card,
.chat-container,
.modal-content {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 28px 32px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background:
        linear-gradient(135deg, rgba(8, 17, 30, 0.96), rgba(12, 29, 49, 0.9)),
        linear-gradient(120deg, rgba(34, 211, 238, 0.08), rgba(20, 241, 149, 0.08));
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent),
        radial-gradient(circle at right center, rgba(34, 211, 238, 0.18), transparent 26%);
    transform: translateX(-35%);
    animation: sweep 12s linear infinite;
    pointer-events: none;
}

@keyframes sweep {
    to {
        transform: translateX(35%);
    }
}

.header-content {
    position: relative;
    z-index: 1;
    max-width: 760px;
}

.header-content h1 {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.brand-logo-shell {
    /* Legacy wrapper (kept for compatibility, but visually neutral). */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.brand-logo {
    width: 100%;
    height: 100%;
    display: block;
}

.brand-logo-img {
    width: auto;
    height: 56px;
    display: block;
    filter:
        drop-shadow(0 12px 22px rgba(0, 0, 0, 0.40))
        drop-shadow(0 0 22px rgba(34, 211, 238, 0.06));
}

.brand-logo--img {
    object-fit: contain;
}

.brand-logo-img--header {
    height: 56px;
}

.brand-logo-img--auth {
    width: min(340px, 82%);
    height: auto;
    max-height: 96px;
    flex-shrink: 0;
}

.brand-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.7rem, 2vw, 2.35rem);
    line-height: 1.06;
    color: #f8fbff;
    letter-spacing: -0.04em;
}

.header-content p {
    max-width: 62ch;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
}

.health-status {
    position: relative;
    z-index: 1;
    min-width: 210px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.95rem 1.2rem;
    border-radius: 18px;
    border: 1px solid rgba(110, 231, 255, 0.18);
    background: rgba(4, 11, 20, 0.62);
    color: var(--text-muted);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.healthy {
    background: var(--success);
    box-shadow: 0 0 14px rgba(20, 241, 149, 0.72);
}

.status-dot.loading {
    background: var(--accent);
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.72);
    animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.56;
        transform: scale(0.88);
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    padding: 4px 0;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.4rem 1.35rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(9, 18, 32, 0.92), rgba(10, 21, 36, 0.78));
    box-shadow: var(--shadow-md);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    opacity: 0.9;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--line-strong);
    box-shadow: 0 20px 40px rgba(0, 8, 18, 0.38);
}

.stat-card h3 {
    margin-bottom: 0.85rem;
    color: var(--text-soft);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.stat-card .value {
    color: #f8fbff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.stat-card .label {
    margin-top: 0.45rem;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.content-wrapper {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.sidebar {
    padding: 1.2rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(7, 16, 29, 0.9), rgba(8, 18, 32, 0.76));
    box-shadow: var(--shadow-md);
    align-self: start;
    position: sticky;
    top: 24px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.95rem 1rem;
    border: 1px solid transparent;
    border-radius: 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.nav-item:hover {
    transform: translateX(4px);
    color: var(--text);
    border-color: rgba(34, 211, 238, 0.16);
    background: rgba(17, 34, 56, 0.7);
}

.nav-item.active {
    color: #f8fbff;
    border-color: rgba(20, 241, 149, 0.22);
    background: linear-gradient(90deg, rgba(20, 241, 149, 0.14), rgba(34, 211, 238, 0.08));
    box-shadow: inset 0 0 0 1px rgba(20, 241, 149, 0.08);
}

.icon,
i.icon,
.stat-card i,
.overview-card i {
    color: var(--accent);
}

.main-content {
    min-width: 0;
    padding: 0;
}

.panel {
    display: none;
    animation: fadeIn 0.28s ease;
}

.panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel h2 {
    margin-bottom: 1.4rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.85rem;
    letter-spacing: -0.03em;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.4rem;
    flex-wrap: wrap;
}

.filters {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.filter-select,
.search-input,
.chat-input {
    width: auto;
    min-height: 46px;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(110, 231, 255, 0.14);
    background: rgba(6, 14, 26, 0.92);
    color: var(--text);
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.filter-select:hover,
.search-input:hover,
.chat-input:hover {
    border-color: rgba(34, 211, 238, 0.24);
}

.filter-select:focus,
.search-input:focus,
.chat-input:focus {
    outline: none;
    transform: translateY(-1px);
    border-color: rgba(20, 241, 149, 0.42);
    box-shadow: 0 0 0 3px rgba(20, 241, 149, 0.08);
}

.search-input {
    min-width: 280px;
}

.search-input::placeholder,
.chat-input::placeholder {
    color: var(--text-soft);
}

.overview-grid,
.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.overview-card,
.scenario-card,
.list-item,
.chat-container {
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(9, 18, 31, 0.88), rgba(11, 23, 39, 0.72));
    box-shadow: var(--shadow-md);
}

.overview-card,
.scenario-card,
.list-item {
    position: relative;
    overflow: hidden;
}

.overview-card::before,
.scenario-card::before,
.list-item::before {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(34, 211, 238, 0), rgba(34, 211, 238, 0.65), rgba(20, 241, 149, 0));
}

.overview-card,
.scenario-card {
    padding: 1.5rem;
}

.overview-card h3,
.scenario-card h4 {
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: -0.02em;
}

.chart-placeholder {
    min-height: 250px;
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(6, 14, 25, 0.96), rgba(10, 20, 34, 0.86));
    border: 1px solid rgba(110, 231, 255, 0.08);
    color: var(--text-muted);
}

.metric {
    margin-bottom: 1.35rem;
    padding: 1rem 1.1rem;
    border-radius: 16px;
    background: rgba(8, 17, 31, 0.64);
    border: 1px solid rgba(110, 231, 255, 0.08);
}

.metric:last-child,
.scenario-metric:last-child,
.user-detail-section:last-child {
    margin-bottom: 0;
}

.metric-value,
.scenario-metric-value {
    color: #f8fbff;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.metric-value {
    font-size: 1.9rem;
}

.metric-label,
.scenario-metric-label,
.section-help,
.detail-label,
.list-item-description,
.empty-state,
.message-time,
.chat-response-info,
.chat-response-pagination-info {
    color: var(--text-muted);
}

.metric-label {
    margin-top: 0.45rem;
    font-size: 0.88rem;
}

.action-summary {
    display: grid;
    gap: 0.8rem;
}

.action-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: rgba(8, 18, 31, 0.72);
    border: 1px solid rgba(110, 231, 255, 0.08);
}

.action-summary-item .label {
    color: var(--text-muted);
}

.action-summary-item .count {
    min-width: 44px;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    color: #031019;
    font-weight: 800;
    text-align: center;
}

.list-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.list-item {
    padding: 1.4rem;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.list-item:hover,
.scenario-card:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
    box-shadow: 0 18px 40px rgba(0, 9, 19, 0.4);
}

.list-item-header,
.list-item-meta,
.list-item-footer,
.button-group,
.chat-input-area {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
}

.list-item-header,
.list-item-footer {
    justify-content: space-between;
    align-items: flex-start;
}

.list-item-title {
    color: #f8fbff;
    font-size: 1.08rem;
    font-weight: 700;
}

.list-item-meta {
    margin: 0.9rem 0 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.list-item-footer {
    padding-top: 1rem;
    border-top: 1px solid rgba(110, 231, 255, 0.08);
    align-items: center;
}

.list-item-value {
    color: var(--primary);
    font-weight: 700;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.76rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: capitalize;
    border: 1px solid transparent;
}

.badge.severity-critical,
.badge.priority-critical {
    background: rgba(255, 77, 109, 0.14);
    color: #ff9bad;
    border-color: rgba(255, 77, 109, 0.22);
}

.badge.severity-high,
.badge.priority-high {
    background: rgba(245, 158, 11, 0.14);
    color: #f9c86a;
    border-color: rgba(245, 158, 11, 0.24);
}

.badge.severity-medium,
.badge.status-pending {
    background: rgba(34, 211, 238, 0.14);
    color: #8be8f6;
    border-color: rgba(34, 211, 238, 0.24);
}

.badge.severity-low,
.badge.status-approved,
.badge.status-executed {
    background: rgba(20, 241, 149, 0.14);
    color: #88f3c3;
    border-color: rgba(20, 241, 149, 0.22);
}

button,
.chat-send-btn {
    min-height: 44px;
    padding: 0.72rem 1.05rem;
    border-radius: 14px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

button:hover,
.chat-send-btn:hover {
    transform: translateY(-1px);
}

.btn-primary,
.chat-send-btn {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: #031019;
    box-shadow: 0 10px 24px rgba(20, 241, 149, 0.16);
}

.btn-primary:hover,
.chat-send-btn:hover {
    box-shadow: 0 14px 28px rgba(20, 241, 149, 0.22);
}

.btn-secondary {
    background: rgba(7, 17, 31, 0.9);
    color: var(--text);
    border-color: rgba(110, 231, 255, 0.16);
}

.btn-secondary:hover {
    border-color: rgba(34, 211, 238, 0.32);
    color: var(--accent);
}

.btn-success {
    background: linear-gradient(135deg, #34d399, #14f195);
    color: #031019;
}

.btn-danger {
    background: linear-gradient(135deg, #f97316, #ff4d6d);
    color: #fff7f8;
}

.scenario-card {
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.scenario-metric {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(110, 231, 255, 0.08);
}

.scenario-metric-value {
    font-size: 1.65rem;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    padding: 24px;
    background: rgba(2, 6, 12, 0.76);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    width: min(900px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    position: relative;
    padding: 2rem;
    border-radius: 26px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(7, 16, 29, 0.96), rgba(9, 19, 33, 0.88));
    box-shadow: var(--shadow-lg);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    color: var(--text-muted);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    font-family: inherit;
}

.modal-close:hover {
    color: var(--text);
}

.user-detail-section {
    margin-bottom: 1.8rem;
    padding-bottom: 1.4rem;
    border-bottom: 1px solid rgba(110, 231, 255, 0.08);
}

.user-detail-section h3 {
    margin-bottom: 1rem;
    color: var(--accent);
    font-family: 'Space Grotesk', sans-serif;
}

.detail-row {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.detail-value {
    color: var(--text);
    overflow-wrap: anywhere;
}

.empty-state {
    padding: 2.2rem;
    text-align: center;
    border-radius: var(--radius-lg);
    border: 1px dashed rgba(110, 231, 255, 0.16);
    background: rgba(6, 14, 25, 0.45);
}

.empty-state-icon {
    margin-bottom: 0.8rem;
    font-size: 2.6rem;
}

/* List pagination (Users / Risks / Actions) */
.list-pagination {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: rgba(6, 14, 25, 0.45);
}

.list-pagination-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.list-pagination-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.list-pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.list-pagination-btn {
    min-height: 38px;
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(110, 231, 255, 0.14);
    background: rgba(14, 30, 49, 0.55);
    color: var(--text);
    font-weight: 700;
}

.list-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.list-pagination-page {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0 0.25rem;
}

.list-pagination-size {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding-left: 0.25rem;
}

.list-pagination-select {
    min-height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(110, 231, 255, 0.16);
    background: rgba(4, 11, 20, 0.72);
    color: var(--text);
    padding: 0.4rem 0.6rem;
    font-weight: 700;
}

.chat-container {
    display: flex;
    flex-direction: column;
    /* ChatGPT-like: fixed composer + scrollable history inside the panel */
    height: clamp(560px, 72vh, 860px);
    min-height: 560px;
    overflow: hidden;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
    min-height: 0;
    padding: 1.4rem;
    /* Keep last message above the fixed composer */
    padding-bottom: calc(1.4rem + 92px);
    background:
        linear-gradient(180deg, rgba(4, 11, 20, 0.86), rgba(8, 16, 28, 0.94));
    overflow-y: auto;
}

.chat-input-area {
    position: sticky;
    bottom: 0;
    z-index: 5;
    backdrop-filter: blur(10px);
}

.chat-message {
    max-width: min(95%, 1200px);
    display: flex;
    flex-direction: column;
}

.chat-message.user {
    align-self: flex-end;
}

.chat-message.bot,
.chat-message.system,
.chat-message.error {
    align-self: flex-start;
}

.message-content {
    padding: 0.95rem 1rem;
    border-radius: 18px;
    line-height: 1.6;
}

.chat-message.user .message-content {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: #031019;
    border-bottom-right-radius: 6px;
}

.chat-message.bot .message-content {
    background: rgba(14, 30, 49, 0.88);
    border: 1px solid rgba(110, 231, 255, 0.12);
    color: var(--text);
    border-bottom-left-radius: 6px;
}

.chat-message-playbook .message-content {
    max-width: 100%;
    border-color: rgba(20, 241, 149, 0.18);
}

.chat-message.system .message-content {
    background: linear-gradient(135deg, rgba(10, 28, 46, 0.94), rgba(11, 44, 64, 0.9));
    border: 1px solid rgba(34, 211, 238, 0.16);
    color: var(--text);
    border-bottom-left-radius: 6px;
}

.chat-message.error .message-content {
    background: rgba(78, 18, 27, 0.88);
    border: 1px solid rgba(255, 77, 109, 0.2);
    color: #ffd7de;
    border-bottom-left-radius: 6px;
}

.message-time {
    margin-top: 0.35rem;
    padding: 0 0.25rem;
    font-size: 0.74rem;
}

.chat-message-details {
    margin-top: 0.65rem;
    padding: 0.9rem;
    border-radius: 14px;
    border: 1px solid rgba(34, 211, 238, 0.12);
    background: rgba(6, 14, 25, 0.56);
}

.chat-message-details summary {
    color: var(--accent);
    cursor: pointer;
    font-weight: 700;
}

.chat-message-details pre {
    margin-top: 0.8rem;
    padding: 0.9rem;
    overflow-x: auto;
    border-radius: 12px;
    background: rgba(2, 8, 15, 0.84);
}

.chat-message-details code {
    color: #a5f3fc;
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-size: 0.82rem;
}

.typing-indicator {
    display: flex;
    gap: 6px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.35;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-8px);
    }
}

.chat-input-area {
    align-items: center;
    padding: 1rem;
    border-top: 1px solid rgba(110, 231, 255, 0.08);
    background: rgba(6, 14, 25, 0.82);
}

.chat-input {
    flex: 1;
}

.chat-response-context {
    display: block;
    margin-bottom: 0.75rem;
    color: #a5f3fc;
    font-weight: 600;
}

.chat-response-table-wrapper {
    overflow-x: auto;
    margin-top: 0.6rem;
    border-radius: 14px;
    border: 1px solid rgba(110, 231, 255, 0.1);
}

.chat-response-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.chat-response-table th {
    padding: 0.8rem;
    background: rgba(34, 211, 238, 0.08);
    color: #cffafe;
    text-align: left;
    border-bottom: 1px solid rgba(110, 231, 255, 0.12);
}

.chat-response-table td {
    padding: 0.78rem 0.8rem;
    color: var(--text);
    border-bottom: 1px solid rgba(110, 231, 255, 0.06);
}

.chat-response-table tbody tr:hover {
    background: rgba(34, 211, 238, 0.04);
}

.chat-response-text,
.chat-response-summary {
    color: var(--text);
}

.chat-response-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.chat-pagination-btn {
    min-height: 38px;
    padding: 0.52rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(110, 231, 255, 0.16);
    background: rgba(8, 18, 31, 0.76);
    color: var(--accent);
    cursor: pointer;
}

.chat-pagination-btn:hover:not(:disabled) {
    border-color: rgba(20, 241, 149, 0.24);
    color: var(--primary);
}

.chat-pagination-btn:disabled,
button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(6, 14, 25, 0.84);
}

::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(34, 211, 238, 0.72), rgba(20, 241, 149, 0.72));
}

@media (max-width: 1080px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }
}

@media (max-width: 760px) {
    .container {
        padding: 16px;
    }

    .header {
        padding: 22px 20px;
        flex-direction: column;
        align-items: flex-start;
    }

    .header-content h1 {
        align-items: flex-start;
    }

    .brand-logo-img--header {
        height: 50px;
    }

    .health-status {
        min-width: 0;
        width: 100%;
    }

    .nav-menu {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .panel-header,
    .list-item-footer,
    .list-item-header,
    .chat-input-area {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input,
    .filter-select {
        width: 100%;
        min-width: 0;
    }

    .detail-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .chat-message {
        max-width: 100%;
    }
}

@media (max-width: 540px) {
    .auth-corner-brand {
        top: 16px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    .brand-logo-img--corner {
        width: min(260px, 62vw);
        max-height: 72px;
    }

    .nav-menu {
        grid-template-columns: 1fr;
    }

    .brand-title {
        font-size: 1.5rem;
    }

    .brand-logo-img--auth {
        width: min(300px, 86%);
        max-height: 84px;
    }

    .brand-subtitle {
        font-size: 0.78rem;
    }

    .stats-grid,
    .overview-grid,
    .scenarios-grid {
        grid-template-columns: 1fr;
    }
}

/* Chat: playbooks, insights, simulate */
.chat-answer-playbook {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-playbook-header {
    padding: 1rem 1.1rem;
    background: linear-gradient(135deg, rgba(20, 241, 149, 0.08), rgba(34, 211, 238, 0.06));
    border: 1px solid rgba(20, 241, 149, 0.22);
    border-radius: var(--radius-md);
}

.chat-playbook-kicker {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 0.35rem;
}

.chat-playbook-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.4rem 0;
    text-transform: capitalize;
}

.chat-playbook-sub {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.chat-welcome-extra {
    margin: 0.75rem 0 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.chat-welcome-extra code {
    font-size: 0.78em;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    background: rgba(110, 231, 255, 0.12);
    color: var(--accent);
}

.simulate-modal-panel {
    width: min(960px, 100%);
}

.simulate-modal-title {
    margin: 0 2.25rem 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    font-family: 'Space Grotesk', sans-serif;
}

.simulate-modal-intro {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.simulate-modal-body {
    margin-bottom: 1rem;
}

.simulate-modal-raw {
    margin-top: 0.5rem;
}

.chat-insights-card {
    padding: 0.85rem 1rem;
    background: rgba(6, 14, 25, 0.55);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.chat-insights-label,
.chat-table-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.chat-table-card {
    padding: 0.65rem 0 0;
}

.chat-table-card .chat-response-table-wrapper {
    margin-top: 0;
}

.chat-insights {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.chat-insights li {
    margin-bottom: 0.45rem;
}

.chat-suggested-actions {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    display: block;
}

.chat-sim-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.65rem;
    align-items: center;
}

.chat-sim-picker-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    margin-top: 0.65rem;
}

.chat-sim-select {
    min-width: min(520px, 100%);
    flex: 1;
    min-height: 44px;
    padding: 0.65rem 0.85rem;
    border-radius: 14px;
    border: 1px solid rgba(110, 231, 255, 0.16);
    background: rgba(6, 14, 26, 0.92);
    color: var(--text);
    font: inherit;
    font-weight: 700;
}

.chat-sim-go {
    min-height: 44px;
    padding: 0.65rem 1rem;
    border-radius: 14px;
}

.chat-sim-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.chat-sim-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.65rem;
}

.chat-sim-btn {
    display: inline-block;
    margin: 0;
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    font-family: inherit;
    color: var(--bg);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: var(--glow);
}

.chat-sim-btn:hover {
    filter: brightness(1.08);
}

.chat-message-simulate .message-content {
    border-color: rgba(20, 241, 149, 0.15);
}

.chat-sim-message-inner {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.chat-sim-msg-header {
    font-size: 0.88rem;
    color: var(--text);
    margin-bottom: 0.75rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(110, 231, 255, 0.12);
    line-height: 1.4;
}

.chat-sim-msg-header strong {
    color: var(--primary);
    margin-right: 0.35rem;
}

.chat-sim-msg-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.chat-sim-msg-meta code {
    font-family: 'IBM Plex Mono', 'Consolas', monospace;
    font-size: 0.85em;
    color: var(--accent);
    background: rgba(34, 211, 238, 0.1);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.chat-sim-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.chat-sim-card {
    background: rgba(6, 14, 25, 0.72);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    min-width: 0;
}

.chat-sim-card-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent);
    background: rgba(34, 211, 238, 0.09);
    border-bottom: 1px solid rgba(110, 231, 255, 0.1);
}

.chat-sim-card-icon {
    opacity: 0.9;
    font-size: 0.95rem;
}

.chat-sim-card-body {
    padding: 0.5rem 0.65rem 0.65rem;
    font-size: 0.8rem;
}

.chat-sim-row {
    padding: 0.35rem 0;
    border-bottom: 1px solid rgba(110, 231, 255, 0.06);
}

.chat-sim-row:last-child {
    border-bottom: none;
}

.chat-sim-field-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: capitalize;
    color: var(--text-soft);
    margin-bottom: 0.12rem;
}

.chat-sim-field-value {
    color: var(--text);
    line-height: 1.4;
    word-break: break-word;
}

.chat-sim-field-value.chat-sim-tags {
    color: var(--accent);
    font-size: 0.78rem;
}

.chat-sim-subblock {
    margin-top: 0.35rem;
    padding: 0.45rem 0.5rem;
    background: rgba(2, 8, 15, 0.55);
    border-radius: 8px;
    border: 1px solid rgba(110, 231, 255, 0.08);
}

.chat-sim-subblock .chat-sim-row:first-child {
    padding-top: 0;
}

.chat-sim-raw {
    margin-top: 0.25rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.chat-sim-raw summary {
    cursor: pointer;
    color: var(--text-soft);
    padding: 0.35rem 0;
    user-select: none;
}

.chat-sim-raw summary:hover {
    color: var(--accent);
}

.chat-sim-result {
    margin: 0.5rem 0 0;
    padding: 0.75rem;
    font-size: 0.75rem;
    line-height: 1.35;
    overflow-x: auto;
    background: var(--bg-alt);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    max-height: 200px;
    border: 1px solid rgba(110, 231, 255, 0.1);
}

.chat-sql-details {
    margin-top: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.chat-sql-details summary {
    cursor: pointer;
    color: var(--accent);
}

.chat-sql-pre {
    margin-top: 0.5rem;
    padding: 0.75rem;
    font-size: 0.75rem;
    overflow-x: auto;
    white-space: pre-wrap;
    background: var(--bg-alt);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
}
