/* SQLWatchmen brand — matches https://www.sqlwatchmen.com */
:root {
    --sw-orange: #f36c21;
    --sw-orange-dark: #d95a15;
    --sw-orange-soft: #fdf1ed;
    --sw-ink: #222222;
    --sw-muted: #555555;
    --sw-bg: #f7f7f7;
    --sw-surface: #ffffff;
    --sw-border: #e8e8e8;
}

html, body {
    font-family: "Segoe UI", system-ui, sans-serif;
    margin: 0;
    background: var(--sw-bg);
    color: var(--sw-ink);
}

.page {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--sw-surface);
    color: var(--sw-ink);
    flex-shrink: 0;
    border-right: 1px solid var(--sw-border);
}

.sidebar .navbar-brand {
    color: var(--sw-ink);
    font-weight: 600;
    padding: 0.75rem 1.25rem;
}

.sidebar-brand {
    padding: 1rem 1rem 0.9rem;
    border-bottom: 1px solid var(--sw-border);
}

.sidebar-brand .brand-logo {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    text-decoration: none;
    color: inherit;
    line-height: 1.15;
}

.sidebar-brand .brand-wordmark {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
}

.sidebar-brand .brand-sql {
    color: var(--sw-orange);
    font-weight: 700;
}

.sidebar-brand .brand-name {
    color: var(--sw-ink);
    font-weight: 800;
    letter-spacing: 0.02em;
}

.sidebar-brand .brand-product {
    color: var(--sw-muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.nav-scrollable {
    padding: 0.75rem 0.75rem 1.25rem;
}

.nav-scrollable .nav-item {
    margin-bottom: 0.65rem;
}

.nav-scrollable .nav-link {
    color: var(--sw-muted);
    padding: 0.55rem 0.85rem;
    border-radius: 6px;
    line-height: 1.35;
    white-space: nowrap;
    display: block;
}

.nav-scrollable .nav-link:hover {
    color: var(--sw-ink);
    background: var(--sw-orange-soft);
}

.nav-scrollable .nav-link.active {
    color: var(--sw-orange-dark);
    background: var(--sw-orange-soft);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--sw-orange);
}

main {
    flex: 1;
    min-width: 0;
}

.top-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    height: 3rem;
    background: var(--sw-surface);
    border-bottom: 1px solid var(--sw-border);
}

.top-row a {
    color: var(--sw-orange);
    text-decoration: none;
    font-weight: 600;
}

.top-row a:hover {
    color: var(--sw-orange-dark);
    text-decoration: underline;
}

.content {
    padding: 1.25rem 0;
}

.fleet-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.page-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 1rem;
}

.page-tab {
    appearance: none;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #64748b;
    cursor: pointer;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: -1px;
    padding: 0.65rem 1rem;
}

.page-tab:hover {
    color: var(--sw-ink);
}

.history-date-label {
    display: inline-flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: #64748b;
}

.history-date-input,
.history-select {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font: inherit;
    min-height: 2rem;
    padding: 0.35rem 0.5rem;
}

.history-table-wrap {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: auto;
}

.history-table {
    border-collapse: collapse;
    width: 100%;
}

.history-table th,
.history-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 0.6rem 0.75rem;
    text-align: left;
    white-space: nowrap;
}

.history-table th {
    background: #f8fafc;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 600;
}

.history-table th.sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.history-table th.sortable-th:hover {
    color: var(--sw-orange-dark);
}

.history-table tbody tr.query-row-clickable {
    cursor: pointer;
}

.history-table tbody tr.query-row-clickable:hover {
    background: var(--sw-orange-soft);
}

.tab-panel {
    min-height: 200px;
}

.page-tab-active {
    border-bottom-color: var(--sw-orange);
    color: var(--sw-orange-dark);
}

.fleet-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
    row-gap: 0.85rem;
}

.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    white-space: nowrap;
    margin: 0;
    min-height: 2rem;
}

.filter-toggle .k-switch {
    flex-shrink: 0;
}

/* Default theme shows ON/OFF inside the track; hide when we use external labels. */
.filter-toggle .k-switch-label-on,
.filter-toggle .k-switch-label-off {
    display: none !important;
}

.refresh-hint {
    font-size: 0.85rem;
    color: #64748b;
}

.kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.kpi-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.kpi-label {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.kpi-up { color: #15803d; }
.kpi-down { color: #b91c1c; }
.kpi-stale { color: #b45309; }
.kpi-critical { color: #dc2626; }

.company-swimlane {
    margin-bottom: 1rem;
}

.company-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

.company-name {
    font-weight: 600;
}

.company-count {
    color: #64748b;
    font-size: 0.9rem;
}

.company-toggle {
    margin-left: auto;
    font-weight: 700;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.heatmap-tile {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    padding: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.heatmap-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}

.severity-tile { background: #e2e8f0; }
.severity-info { background: #e2e8f0; }
.severity-low { background: #dbeafe; }
.severity-medium { background: #fef3c7; }
.severity-high { background: #fed7aa; }
.severity-critical { background: #fecaca; }
.severity-down { background: #7f1d1d; color: #fff; }
.severity-unavailable { background: #450a0a; color: #fff; }

.tile-title {
    font-weight: 700;
    font-size: 1rem;
}

.tile-subtitle {
    font-size: 0.85rem;
    opacity: 0.85;
}

.tile-metrics {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.tile-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.65rem;
    font-size: 0.8rem;
}

.badge-severity-info,
.badge-severity-low,
.badge-severity-medium,
.badge-severity-high,
.badge-severity-critical,
.badge-severity-down,
.badge-severity-unavailable {
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.75rem;
}

.badge-severity-info { background: #cbd5e1; }
.badge-severity-low { background: #93c5fd; }
.badge-severity-medium { background: #fde68a; }
.badge-severity-high { background: #fdba74; }
.badge-severity-critical { background: #fca5a5; }
.badge-severity-down { background: #991b1b; color: #fff; }
.badge-severity-unavailable { background: #450a0a; color: #fff; }

.liveness-up { color: #15803d; font-weight: 600; }
.liveness-down { color: #b91c1c; font-weight: 600; }
.liveness-stale { color: #b45309; font-weight: 600; }

.severity-down .liveness-down,
.severity-unavailable .liveness-down {
    color: #fecaca;
}

.alarm-badge {
    background: var(--sw-orange);
    color: #fff;
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    font-size: 0.75rem;
    text-decoration: none;
}

.alarm-badge-link {
    cursor: pointer;
}

.alarms-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    row-gap: 0.85rem;
    margin-bottom: 1rem;
}

.findings-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.findings-detail-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    min-height: 520px;
}

.detail-placeholder {
    color: #64748b;
    margin-top: 2rem;
}

.finding-detail h2 {
    font-size: 1.15rem;
    margin: 0 0 0.5rem;
}

.detail-meta {
    margin: 0 0 1rem;
}

.detail-flags {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.detail-flags dt {
    font-weight: 600;
    color: #475569;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.dynamic-data-block pre {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.8rem;
    overflow-x: auto;
    max-height: 240px;
}

.transition-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
}

.transition-list li {
    padding: 0.35rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.alert-info {
    background: var(--sw-orange-soft);
    border: 1px solid #f3c4a8;
    color: #9a4010;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-top: 0.75rem;
}

@media (max-width: 1100px) {
    .findings-layout {
        grid-template-columns: 1fr;
    }
}

.filter-chip {
    background: var(--sw-orange-soft);
    color: var(--sw-orange-dark);
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
}

.status-open { color: #b45309; font-weight: 600; }
.status-acked { color: #15803d; font-weight: 600; }
.status-stale { color: #64748b; font-weight: 600; margin-right: 0.35rem; }

.history-table tbody tr.config-highlight-nondefault {
    background: var(--sw-orange-soft);
}

.history-table tbody tr.config-highlight-warning {
    background: #fef08a;
}

.history-table tbody tr.config-highlight-critical {
    background: #fecaca;
}

/* Collector inventory: last-run duration bands (indigo / fuchsia until warning/critical). */
.history-table tbody tr.collector-duration-notice {
    background: #fff4ec; /* warm tint — >= 1s */
}

.history-table tbody tr.collector-duration-elevated {
    background: #fae8ff; /* fuchsia tint — > 10s */
}

.history-table tbody tr.collector-duration-warning {
    background: #fef08a; /* yellow — > 1 minute */
}

.history-table tbody tr.collector-duration-critical {
    background: #fecaca; /* red — > 10 minutes */
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-warn {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.88rem;
}

.preview-scope-note {
    margin-bottom: 0.75rem;
}

.instance-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.instance-meta {
    color: #64748b;
    margin: 0;
}

.instance-badges {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.health-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

/* Piece D — fleet worst-N strip */
.worst-n-strip {
    margin-bottom: 1.25rem;
}

.worst-n-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.worst-n-title {
    margin: 0;
    font-size: 1.05rem;
}

.worst-n-hint {
    margin: 0;
}

.worst-n-track {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.35rem;
}

.worst-n-card {
    flex: 0 0 200px;
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    border: 1px solid #e2e8f0;
    min-height: 110px;
}

.worst-n-card:hover {
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.worst-n-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.worst-n-card-sub {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.worst-n-card-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.55rem;
    font-size: 0.78rem;
    margin-bottom: 0.45rem;
}

.worst-n-card-footer {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Piece D — instance flow diagram */
.flow-diagram {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.85rem 1rem 1rem;
    margin-bottom: 1.25rem;
}

.flow-diagram-header {
    margin-bottom: 0.75rem;
}

.flow-diagram-title {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
}

.flow-diagram-canvas {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 0.5rem;
}

.flow-subsystem-col {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.flow-node {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    min-width: 120px;
    text-align: left;
    cursor: pointer;
    background: #f8fafc;
    color: inherit;
    font: inherit;
}

button.flow-node:hover {
    box-shadow: 0 1px 6px rgba(15, 23, 42, 0.12);
}

.flow-node-engine {
    cursor: default;
    min-width: 130px;
}

.flow-node-label {
    display: block;
    font-size: 0.75rem;
    color: #475569;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.flow-node-value {
    display: block;
    font-size: 0.95rem;
    margin-top: 0.15rem;
}

.flow-node-meta {
    display: block;
    font-size: 0.75rem;
    opacity: 0.85;
}

.flow-arrow {
    color: #94a3b8;
    font-size: 1.25rem;
    font-weight: 700;
    user-select: none;
}

.severity-down .flow-node-label,
.severity-unavailable .flow-node-label,
.severity-down .flow-node-meta,
.severity-unavailable .flow-node-meta {
    color: #fecaca;
}

/* Piece D — sparklines */
.sparkline-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.85rem 1rem 0.5rem;
    margin-bottom: 1.25rem;
}

.sparkline-title {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
}

.sparkline-chart {
    margin-top: 0.25rem;
}

@media (max-width: 720px) {
    .flow-diagram-canvas {
        flex-direction: column;
        align-items: stretch;
    }

    .flow-arrow {
        transform: rotate(90deg);
        align-self: center;
    }

    .flow-subsystem-col {
        width: 100%;
    }

    .flow-node {
        width: 100%;
    }
}

.health-metric {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem;
}

.health-metric span {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
}

.chart-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.chart-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem;
}

.chart-card h2 {
    font-size: 1rem;
    margin: 0 0 0.5rem;
}

.chart-card-wide {
    grid-column: 1 / -1;
}

.activity-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    row-gap: 0.85rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.activity-filter-text {
    min-width: 9rem;
}

.instance-range-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
}

.empty-hint {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

.deadlock-graph-xml {
    max-height: 24rem;
    overflow: auto;
    margin: 0;
    padding: 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.deadlock-graph-row td {
    background: #f8fafc;
}

.activity-row {
    cursor: pointer;
}

.activity-row:hover td {
    background: #f1f5f9;
}

.activity-cap-banner {
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 0.375rem;
    color: #92400e;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    padding: 0.6rem 0.85rem;
}

.activity-grid-pager {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.activity-grid-pager-summary {
    color: #475569;
    font-size: 0.9rem;
}

.activity-grid-page-size {
    margin-bottom: 0;
}

.activity-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.row-blocked td {
    background: #fff7ed;
}

.sql-snippet {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.session-detail-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 10000;
}

.session-detail-plan-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1rem;
}

.query-plan-fullscreen-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 10002;
}

.query-plan-fullscreen {
    position: fixed;
    inset: 0.75rem;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.28);
    z-index: 10003;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.query-plan-fullscreen-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.query-plan-fullscreen-title {
    margin: 0;
    font-size: 1.15rem;
}

.query-plan-fullscreen-subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: #64748b;
    font-family: Consolas, "Courier New", monospace;
}

.query-plan-fullscreen-close {
    border: none;
    background: transparent;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
    padding: 0 0.25rem;
}

.query-plan-fullscreen-close:hover {
    color: #0f172a;
}

.query-plan-fullscreen-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0.75rem 1.25rem 1rem;
}

/* Plan graph SVG: Kendo sets svg { fill: currentColor } — force blue cards + dark text on all nodes. */
svg.plan-graph-svg {
    fill: none;
    color: #0c0a09;
}

svg.plan-graph-svg text.graph-title {
    fill: #0c0a09 !important;
    font-size: 13px;
    font-weight: 700;
}

svg.plan-graph-svg text.graph-subtitle {
    fill: #1c1917 !important;
    font-size: 11px;
    font-weight: 600;
}

svg.plan-graph-svg text.graph-meta {
    fill: #292524 !important;
    font-size: 10.5px;
    font-weight: 500;
}

svg.plan-graph-svg rect.plan-graph-card-body {
    fill: #eef2ff !important;
    stroke: #93c5fd !important;
    stroke-width: 2px;
}

svg.plan-graph-svg rect.plan-graph-card-accent {
    fill: #2563eb !important;
}

svg.plan-graph-svg rect.plan-graph-card-icon-tile {
    fill: #ffffff !important;
    stroke: #bfdbfe !important;
}

svg.plan-graph-svg .plan-graph-card-icon,
svg.plan-graph-svg .plan-graph-card-icon * {
    stroke: #1d4ed8 !important;
}

svg.plan-graph-svg rect.node-meter-track {
    fill: #bfdbfe !important;
}

.query-plan-viewer .graph-node.warning .plan-graph-card-body,
.query-plan-fullscreen .graph-node.warning .plan-graph-card-body {
    fill: #eef2ff !important;
    stroke: #f59e0b !important;
}

.query-plan-viewer .graph-node.selected .plan-graph-card-body,
.query-plan-fullscreen .graph-node.selected .plan-graph-card-body,
.query-plan-viewer .statement-graph-node.selected .plan-graph-card-body,
.query-plan-fullscreen .statement-graph-node.selected .plan-graph-card-body {
    fill: #dbeafe !important;
    stroke: #1d4ed8 !important;
}

.session-detail-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(1120px, 96vw);
    max-height: 92vh;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.25);
    z-index: 10001;
    display: flex;
    flex-direction: column;
}

.session-detail-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.session-detail-modal-title {
    margin: 0;
    font-size: 1.1rem;
}

.session-detail-close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
    padding: 0 0.25rem;
}

.session-detail-close:hover {
    color: #0f172a;
}

.session-detail-modal-body {
    overflow: auto;
    padding: 0.75rem 1.25rem 1rem;
    flex: 1;
}

.session-detail-modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    text-align: right;
}

.session-detail-heading {
    font-size: 0.95rem;
    margin: 0.75rem 0 0.35rem;
}

.session-detail-sql,
.session-detail-plan {
    max-height: 16rem;
    overflow: auto;
    margin: 0;
    padding: 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.session-detail-error {
    color: #b91c1c;
    font-size: 0.9rem;
}

.empty-state {
    margin: 0;
    color: #64748b;
    font-size: 0.86rem;
}

.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.admin-form {
    display: grid;
    gap: 0.35rem;
}

.destination-picker {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.destination-fieldset {
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    margin: 0.25rem 0;
}

.destination-fieldset legend {
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0 0.25rem;
}

.destination-option {
    margin: 0.35rem 0;
}

.admin-form label {
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.admin-form-grid {
    grid-template-columns: 160px 1fr;
    align-items: center;
    max-width: 640px;
}

.portal-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.45);
}

.portal-modal-panel {
    width: 560px;
    max-width: 100%;
    max-height: 90vh;
    overflow: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
}

.portal-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.portal-modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.portal-modal-close {
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.portal-modal-body {
    padding: 1rem 1.25rem;
}

.portal-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem 1rem;
    border-top: 1px solid #e2e8f0;
}

.admin-toolbar-label {
    font-size: 0.85rem;
    color: #64748b;
    margin-left: 0.5rem;
}

.admin-section {
    margin-bottom: 1.5rem;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.65rem 1rem;
    align-items: center;
}

.admin-api-key {
    background: #0f172a;
    color: #e2e8f0;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
    user-select: all;
}

.admin-analyzers-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
    gap: 1.5rem;
    align-items: start;
}

.admin-analyzers-preview {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    background: #f8fafc;
}

@media (max-width: 1100px) {
    .admin-analyzers-layout {
        grid-template-columns: 1fr;
    }
}

.truncate-cell {
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
