body {
    margin: 0;
    padding: 14px;
    background: #0d1a2b;
    color: #e6edf7;
    font-family: 'Segoe UI', Arial, sans-serif;
}
.page-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
}
.page-container.hide-tables table {
    display: none !important;
}
.page-container.hide-tables .header-card table {
    display: table !important;
}
.page-container.hide-tables .card:not(.header-card):not(.chart-card):not(.always-show) {
    display: none !important;
}
.page-container.hide-tables .always-show-tables table {
    display: table !important;
}
.page-container.hide-tables .always-show-tables .unified-table-wrapper {
    display: block !important;
}
.page-container.hide-tables .unified-table-wrapper {
    display: none !important;
}
.page-container.hide-charts .unified-charts-row {
    display: none !important;
}
html.hide-tables .msg-table {
    display: none !important;
}
html.hide-tables .card:not(.header-card):not(.chart-card):not(.always-show) {
    display: none !important;
}
html.hide-tables .always-show-tables .msg-table {
    display: table !important;
}
html.hide-tables .unified-table-wrapper {
    display: none !important;
}
html.hide-tables .always-show-tables .unified-table-wrapper {
    display: block !important;
}
html.hide-charts .unified-charts-row {
    display: none !important;
}
.collapsible-card.is-collapsed .card-collapse-body {
    display: none !important;
}
.card-collapse-toggle {
    margin-left: auto;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #223450;
    background: rgba(255, 255, 255, 0.04);
    color: #cfe0ff;
    font-size: 0.7rem;
    cursor: pointer;
}
.card-collapse-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}
.data-source-cache > summary {
    list-style: none;
    cursor: pointer;
}
.data-source-cache > summary.header-card {
    justify-content: flex-start;
}
.data-source-cache-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.card-title-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.card-updated {
    font-size: 0.95rem;
    color: #aab8d3;
}
.card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
    justify-content: flex-end;
}
.card-actions .card-collapse-toggle {
    margin-left: 0;
}
.data-source-cache-clear {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #5a1f26;
    background: #7a1f2a;
    color: #ffe5e8;
    font-size: 0.7rem;
    cursor: pointer;
}
.data-source-cache-clear:hover {
    background: #912634;
}
.data-source-cache-clear:disabled {
    opacity: 0.6;
    cursor: default;
}
.sw-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 10, 18, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
    box-sizing: border-box;
}
.sw-modal-overlay.is-visible {
    display: flex;
}
.sw-modal {
    background: #121a2d;
    border: 1px solid #23314a;
    border-radius: 12px;
    padding: 18px 20px;
    max-width: 520px;
    width: 100%;
    color: #e6edf7;
    box-shadow: 0 20px 48px rgba(0,0,0,0.45);
}
.sw-modal-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
}
.sw-modal-body {
    font-size: 0.9rem;
    color: #c9d6ef;
    line-height: 1.4;
}
.sw-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}
.sw-modal-btn {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #2a3b57;
    background: rgba(255, 255, 255, 0.04);
    color: #cfe0ff;
    font-size: 0.8rem;
    cursor: pointer;
}
.sw-modal-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}
.sw-modal-confirm {
    border-color: #5a1f26;
    background: #7a1f2a;
    color: #ffe5e8;
}
.sw-modal-confirm:hover {
    background: #912634;
}
.data-source-cache > summary .card-fullscreen-toggle {
    margin-left: auto;
}
.data-source-cache-actions .card-fullscreen-toggle {
    margin-left: 0;
}
.data-source-cache > summary::-webkit-details-marker {
    display: none;
}
.data-source-cache > summary::after {
    content: 'Expand';
    margin-left: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #223450;
    background: rgba(255, 255, 255, 0.04);
    color: #cfe0ff;
    font-size: 0.7rem;
    cursor: pointer;
}
.data-source-cache[open] > summary::after {
    content: 'Collapse';
}
.card {
    background: #111a2e;
    border: 1px solid #1f2c45;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 10px 26px rgba(0,0,0,0.32);
    margin: 0 auto;
    width: 100%;
    max-width: 1180px;
    box-sizing: border-box;
}
.header-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.header-card td {
    font-size: 24px;
}
.header-card font {
    font-size: inherit;
}
.header-card table {
    width: 100%;
}
.msg-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}
.msg-table th,
.msg-table td {
    padding: 8px 10px;
    font-size: 0.95rem;
}
.msg-table th {
    text-align: left;
    border-bottom: 1px solid #223450;
    color: #bcd3ff;
    font-weight: 600;
}
.msg-table th a {
    color: #bcd3ff;
    text-decoration: none;
}
.msg-table th a:hover {
    text-decoration: underline;
}
.msg-table tr:nth-child(even) {
    background: var(--table-row-even);
}
.msg-table tr:nth-child(odd) {
    background: var(--table-row-odd);
}
.msg-table th.dataset-sep,
.msg-table td.dataset-sep {
    border-left: 1px solid #4ea1ff !important;
}
.msg-table th.dataset-sep-right,
.msg-table td.dataset-sep-right {
    border-right: 1px solid #4ea1ff !important;
}
.metric-pill {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.unified-chart {
    width: 100%;
    height: 320px;
    position: relative;
}
.chart-empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    text-align: center;
    font-size: 0.85rem;
    color: #aab8d3;
}
.unified-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 8px;
    font-size: 0.85rem;
    line-height: 1.2;
}
.unified-chart-desc {
    margin-top: 6px;
    font-size: 0.75rem;
    color: #aab8d3;
    line-height: 1.35;
}
.unified-chart-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    margin-top: 8px;
}
.unified-chart-sources .source-toggle {
    font-size: 0.75rem;
    border: 1px solid #223450;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: #bcd3ff;
    padding: 4px 10px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.unified-chart-sources .log-scale-toggle {
    margin-left: auto;
}
.unified-chart-sources .source-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}
.unified-chart-sources .source-toggle.is-hidden {
    border-color: #4a5d80;
    color: #5c6f8f;
}
.unified-chart-legend .legend-item {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.unified-chart-legend .legend-item:hover {
    filter: brightness(1.15);
}
.unified-chart-legend .legend-item.is-hidden {
    color: #45536b !important;
    text-decoration: line-through;
}
.chart-now-line {
    position: absolute;
    top: 0;
    width: 2px;
    margin-left: -1px;
    z-index: 10;
    background: rgba(255, 209, 102, 0.9);
    box-shadow: 0 0 6px rgba(255, 209, 102, 0.55);
    pointer-events: none;
}
.chart-threshold-line {
    position: absolute;
    height: 1px;
    left: 0;
    right: 0;
    z-index: 5;
    pointer-events: none;
}
.chart-threshold-line span {
    position: absolute;
    right: 0;
    top: -12px;
    font-size: 0.65rem;
    background: rgba(13, 26, 43, 0.85);
    padding: 1px 4px;
    border-radius: 4px;
}
.unified-charts-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.unified-charts-row .chart-card {
    flex: 0 0 auto;
    margin-top: 0;
}
.unified-table-wrapper {
    overflow: auto;
}
.alerts-table-wrapper {
    overflow: auto;
}
.unified-table {
    overflow: visible !important;
}
.unified-table thead th {
    position: sticky;
    background: #0a1218;
}
.unified-table thead tr:nth-child(1) th {
    top: 0;
    z-index: 6;
}
.unified-table thead tr:nth-child(2) th {
    top: var(--unified-header-row1-height, 32px);
    z-index: 5;
}
.unified-table .sticky-col {
    position: sticky;
    left: 0;
    z-index: 4;
    background-color: #111a2e;
    box-shadow: 2px 0 0 #223450;
}
.unified-table th.sticky-col {
    z-index: 8;
    background: #0a1218;
}
.unified-table tbody tr:nth-child(even) td.sticky-col {
    background-color: var(--table-row-even);
}
.unified-table tbody tr:nth-child(odd) td.sticky-col {
    background-color: var(--table-row-odd);
}
.unified-table tbody tr.closest-row td.sticky-col {
    background-color: #4d3f05;
}
.unified-table tbody tr.nearby-row td.sticky-col {
    background-color: #2f2303;
}
.msg-table tr.closest-row {
    background: #4d3f05;
}
.msg-table tr.nearby-row {
    background: #2f2303;
}
.msg-table .col-timestamp,
.msg-table .col-severity,
.msg-table .col-category {
    white-space: nowrap;
    width: 1%;
}
.msg-table .col-details {
    word-wrap: break-word;
    max-width: 600px;
    font-family: 'Segoe UI', Arial, sans-serif;
}
.alerts-table {
    table-layout: auto;
}
.alerts-table .col-details {
    width: 60%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: none;
}
.ts-delta {
    font-size: 0.78rem;
    color: #8aa3df;
    margin-top: 4px;
}
.pagination {
    margin: 10px 0;
    text-align: center;
    font-size: 0.95rem;
}
.card .header-card {
    cursor: default;
}
#range_start::-webkit-calendar-picker-indicator,
#range_end::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: brightness(0) invert(1);
    opacity: 1;
}
.space-weather-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin: 14px auto 0;
    justify-content: center;
    max-width: 960px;
}
.space-link-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid #2a3754;
    border-radius: 8px;
    padding: 12px;
    min-height: 160px;
}
.space-link-card-wide {
    grid-column: span 2;
    min-width: 360px;
}
@media (max-width: 640px) {
    .space-link-card-wide {
        grid-column: span 1;
    }
}
.space-link-card h4 {
    margin-top: 0;
    margin-bottom: 6px;
}
.space-link-card a {
    color: #92d0ff;
    text-decoration: none;
}
.space-link-card a:hover {
    text-decoration: underline;
}
.space-link-description {
    font-size: 0.72rem;
    color: #c5d5f3;
    line-height: 1.4;
    margin: 0;
}
.space-weather-intro {
    font-size: 0.72rem;
    color: #b9c6e3;
    margin-top: 6px;
}
.card-source {
    font-size: 0.65rem;
    color: #9ab4d7;
    margin-top: 6px;
}
.two-column-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}
.space-metric-list {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: #e6edf7;
}
.space-metric-list li {
    margin-bottom: 4px;
}
.space-metric-label {
    color: #92d0ff;
    font-size: 0.82rem;
    display: inline-block;
    min-width: 140px;
}
.space-metric-value {
    font-weight: 600;
}
.scale-table {
    table-layout: fixed;
    width: 100%;
}
.scale-table .scale-col-level {
    width: 12%;
}
.scale-table .scale-col-middle {
    width: 26%;
}
.scale-table .scale-col-notes {
    width: 62%;
}
