:root {
    color-scheme: dark;
    --background-color: #0b1220;
    --title-background-color: #17243a;
    --button-background-color: #243751;
    --element-background-color: #142238;
    --section-border-color: #263b56;
    --cell-border-color: #263b56;
    --highlight-color: #38bdf8;
    --link-color: #38bdf8;
    --visited-color: #7dd3fc;
    --hover-color: #bae6fd;
    --timestamp-color: #94a3b8;
    --hival-color: #fb7185;
    --loval-color: #60a5fa;
    --ok-color: #4ade80;
    --low-color: #f87171;
}

@font-face {
    font-family: 'Open Sans';
    src: url('font/OpenSans.woff2') format('woff2'),
         url('font/OpenSans.woff') format('woff');
    font-display: swap;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--background-color);
    color: #e5edf7;
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

a {
    color: var(--link-color);
    text-decoration: none;
    cursor: pointer;
    transition: color .2s ease;
}

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

#title_bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 4%;
    margin: 0;
    background: linear-gradient(120deg, #142943, #0e1a2d);
    border-bottom: 1px solid var(--section-border-color);
}

#title {
    margin: 0;
    float: none;
}

.page_title {
    margin: 0;
    color: #f8fafc;
    font-size: 27px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: .5px;
}

.lastupdate {
    margin: 5px 0 0;
    color: var(--timestamp-color);
    font-size: 12px;
    line-height: 1.5;
}

#rss_link {
    float: none;
    margin: 0;
    padding: 7px 15px;
    background: #1e3550;
    border: 1px solid #35516f;
    border-radius: 8px;
}

#reports {
    float: none;
    margin: 0;
    color: #a9bdd3;
    text-align: right;
    font-size: 12px;
    line-height: 2.2;
}

select {
    padding: 6px 10px;
    color: #e5edf7;
    background: #1b2b42;
    border: 1px solid #35516f;
    border-radius: 6px;
}

#contents {
    display: grid;
    grid-template-columns: minmax(280px, 350px) minmax(0, 1fr);
    gap: 22px;
    margin: 24px auto;
    padding: 0 24px;
    max-width: 1800px;
}

#widget_group {
    float: none;
    margin: 0;
    min-width: 0;
}

#plot_group {
    float: none;
    min-width: 0;
    overflow: hidden;
}

.widget {
    clear: both;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--element-background-color);
    border: 1px solid var(--section-border-color);
    border-radius: 12px;
    box-shadow: 0 5px 18px rgba(0,0,0,.16);
}

.widget_title {
    padding: 0 0 12px;
    margin-bottom: 12px;
    color: #f1f5f9;
    font-size: 15px;
    font-weight: 700;
    border-bottom: 1px solid var(--section-border-color);
}

.widget_contents {
    color: #dbeafe;
}

.widget table {
    width: 100%;
    border-collapse: collapse;
}

.widget table td,
.widget table th {
    padding: 7px 4px;
    border-bottom: 1px solid var(--cell-border-color);
}

.widget table tr:last-child td {
    border-bottom: none;
}

.label {
    color: #9fb2c9;
    font-size: 12px;
    text-align: left;
    vertical-align: top;
}

.data {
    color: #f8fafc;
    font-size: 13px;
    font-weight: 700;
    text-align: right;
    vertical-align: top;
}

.units {
    color: #94a3b8;
    font-size: 12px;
}

.timestamp {
    color: var(--timestamp-color);
    font-size: 11px;
}

.hival {
    color: var(--hival-color);
}

.loval {
    color: var(--loval-color);
}

.status_ok {
    color: var(--ok-color);
}

.status_low {
    color: var(--low-color);
}

.widget_control {
    float: right;
    cursor: pointer;
    color: #7dd3fc;
}

.button,
.button_selected {
    display: inline-block;
    cursor: pointer;
    padding: 7px 13px;
    margin: 2px;
    border-radius: 7px;
    font-size: 12px;
}

.button {
    color: #b8c9dc;
    background: #1b2d45;
}

.button_selected {
    color: #071827;
    background: #38bdf8;
    font-weight: 700;
    border: none;
}

#history_widget {
    min-width: 0;
}

#history_widget .widget_title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

#history_widget img {
    display: inline-block;
    width: min(100%, 500px);
    max-width: 100%;
    height: auto;
    margin: 6px 5px 12px 0;
    border: 1px solid #263b56;
    border-radius: 8px;
    background: #fff;
}

.plot_container {
    margin-top: 8px;
}

.celestial_body {
    float: none;
    display: inline-block;
    margin: 5px;
    vertical-align: top;
}

.widget img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--section-border-color);
    border-radius: 7px;
}

#map_canvas {
    width: 100%;
    max-width: 350px;
    height: 300px;
    margin-top: 8px;
    border-radius: 8px;
}

.footnote {
    clear: both;
    padding: 18px 24px;
    color: #71839a;
    font-size: 11px;
    text-align: center;
}

@media (max-width: 950px) {
    #contents {
        grid-template-columns: minmax(0, 1fr);
    }

    #widget_group {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
        align-items: start;
    }

    .widget {
        margin-bottom: 0;
    }

    #plot_group {
        overflow: visible;
    }
}

@media (max-width: 600px) {
    #title_bar {
        padding: 16px;
        gap: 10px;
    }

    .page_title {
        font-size: 22px;
    }

    #reports {
        width: 100%;
        text-align: left;
    }

    #contents {
        display: block;
        margin: 14px auto;
        padding: 0 12px;
    }

    #widget_group {
        display: block;
    }

    #widget_group .widget {
        margin-bottom: 14px;
    }

    #plot_group {
        margin-top: 14px;
    }

    .widget {
        padding: 13px;
    }

    #history_widget img {
        width: 100%;
        margin-right: 0;
    }

    #history_widget .widget_title {
        gap: 3px;
    }

    .button,
    .button_selected {
        padding: 6px 9px;
    }
}
