@font-face {
    font-family: "Open Sans";
    src: url("OpenSans-Regular.ttf");
    font-display: swap;
}

@font-face {
    font-family: "Open Sans";
    src: url("OpenSans-Bold.ttf");
    font-weight: 700;
    font-display: swap;
}

:root, html[data-theme] {
    --primary: #0088cc;
    --secondary: #0077b3;
    --accent: #0088cc;

    --header-color: #777;
    --header-bg: #171717;
    --header-link-color: #fff;

    --breadcrumbs-bg: #171717;
    --breadcrumbs-fg: #c3c3c3;
    --breadcrumbs-link-fg: #c3c3c3;

    --button-bg: #0077b3;
    --button-hover-bg: #005f8f;
    --default-button-bg: #0077b3;
    --default-button-hover-bg: #005f8f;
    --delete-button-bg: #dc3545;
    --delete-button-hover-bg: #bb2d3b;
    --object-tools-bg: #0077b3;
    --object-tools-hover-bg: #005f8f;

    --font-family-primary: "Open Sans", Arial, sans-serif;

    --gutter: 40px;
    --card-header-bg: #3f4c44;
    --card-header-fg: #fff;
    --legend-fg: #ff8533;
    --toolbar-bg: #181818;
    --tile-bg: #4b4b4b;
    --tile-fg: #fff;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --link-fg: #0077b3;
        --link-hover-color: #005f8f;
        --darkened-bg: #f9f9f9;
        --hairline-color: #ddd;
        --selected-row: #e0f3fd;
        --card-header-bg: #efefef;
        --card-header-fg: #151515;
        --legend-fg: #c24e00;
        --toolbar-bg: #efefef;
        --tile-bg: #a0a9a4;
        --tile-fg: #151515;
    }
}

html[data-theme="light"] {
    --link-fg: #0077b3;
    --link-hover-color: #005f8f;
    --darkened-bg: #f9f9f9;
    --hairline-color: #ddd;
    --selected-row: #e0f3fd;
    --card-header-bg: #efefef;
    --card-header-fg: #151515;
    --legend-fg: #c24e00;
    --toolbar-bg: #efefef;
    --tile-bg: #a0a9a4;
    --tile-fg: #151515;
}

#header {
    --header-bg: #fff;
    --header-link-color: #0077b3;
    --body-fg: #001;
    border-top: 3px solid #ededed;
    background: linear-gradient(#f6f6f6, #fff 45%);
}

#site-name a {
    display: flex;
    align-items: center;
    gap: 10px;
}

#site-name img {
    height: 35px;
}

div.breadcrumbs {
    padding: 14px 40px;
    border-bottom: 4px solid var(--primary);
}

#nav-sidebar, #toggle-nav-sidebar {
    --body-bg: #1d2127;
    --body-fg: #abb4be;
    --body-quiet-color: #abb4be;
    --darkened-bg: #21262d;
    --link-fg: #abb4be;
    --link-hover-color: #fff;
    --header-bg: #191c21;
    --header-color: #fff;
    --hairline-color: #2f3139;
    --border-color: #2f3139;
    --selected-row: #0077b3;
}

#nav-sidebar .current-model a {
    color: #fff;
}

#main > .content {
    background: #282828 url("app-bg.png") center / cover fixed no-repeat;
}

#main > .content > #content {
    margin: 24px;
    padding: 0 var(--gutter) 20px;
    background: var(--body-bg);
    border-radius: 4px;
}

#main > .content > .messagelist {
    margin: 24px 24px 0;
}

#content > h1 {
    margin: 0 calc(-1 * var(--gutter)) 20px;
    padding: 16px var(--gutter);
    border-bottom: 5px solid #ccc;
    border-radius: 4px 4px 0 0;
    background: var(--card-header-bg);
    color: var(--card-header-fg);
    font-size: 1.25rem;
    font-weight: 400;
}

#content .module h2, #content .module caption, #content .inline-group h2,
#content fieldset .fieldset-heading, #content .collapse summary {
    border: 0;
    border-bottom: 1px solid var(--hairline-color);
    background: none;
    color: var(--legend-fg);
    font-size: 1.125rem;
    letter-spacing: 0;
    text-transform: none;
}

#content .module caption a {
    color: inherit;
}

#content .object-tools a {
    border-radius: 4px;
}

body.change-list #main > .content > #content {
    position: relative;
    background: var(--toolbar-bg);
}

.change-list #content > h1 {
    border-bottom: 1px solid #ccc;
}

.change-list #content-main {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px 24px;
}

.change-list #content-main > .errornote {
    flex-basis: 100%;
}

.change-list #changelist, .change-list .changelist-form-container {
    display: contents;
}

.change-list #changelist-form {
    order: 2;
    flex: 1 0 100%;
    max-width: 100%;
}

.change-list #content .object-tools {
    display: flex;
    flex-direction: row-reverse;
    gap: 12px;
    float: none;
    margin: 0;
    overflow: visible;
}

.change-list #content .object-tools li {
    height: auto;
    margin: 0;
}

.change-list #content .object-tools a, #changelist-filter summary {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 60px;
    padding: 5px 15px;
    border-radius: 0;
    background: var(--tile-bg);
    color: var(--tile-fg);
    font-size: 0.875rem;
    letter-spacing: 0;
    text-transform: none;
    transition: background 0.2s;
}

.change-list #content .object-tools a:hover, .change-list #content .object-tools a:focus,
#changelist-filter summary:hover, #changelist-filter summary:focus {
    background: #727272;
    color: #fff;
}

.change-list #content .object-tools .addlink::after {
    content: "+";
    margin-left: 5px;
}

#changelist-filter#changelist-filter {
    display: flex;
    flex: 1 1 320px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    order: 1;
    width: auto;
    margin: 0;
    background: none;
}

#content #changelist-filter h2 {
    display: none;
}

#changelist-filter #changelist-filter-extra-actions {
    order: 1;
    margin: 0;
    border: 0;
}

#changelist-filter#changelist-filter h3 {
    margin: 0;
    padding: 0;
}

#changelist-filter details {
    position: relative;
    flex: 1 1 115px;
    max-width: 215px;
}

#changelist-filter#changelist-filter summary {
    flex-direction: column;
    position: relative;
    margin: 0;
    padding: 5px 28px 5px 10px;
    cursor: pointer;
    text-align: center;
    text-transform: uppercase;
}

#changelist-filter summary strong {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: none;
    white-space: nowrap;
}

#changelist-filter#changelist-filter summary::before {
    content: "";
    position: absolute;
    top: calc(50% - 6px);
    right: 12px;
    width: 7px;
    height: 7px;
    border: solid;
    border-width: 0 2px 2px 0;
    color: inherit;
    transform: rotate(45deg);
}

#changelist-filter#changelist-filter details[open] summary::before {
    transform: translateY(4px) rotate(225deg);
}

#changelist-filter#changelist-filter details ul {
    position: absolute;
    z-index: 10;
    box-sizing: border-box;
    width: 100%;
    max-height: 320px;
    margin: 0;
    padding: 8px 15px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    background: var(--body-bg);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .3);
}

#changelist-filter details li {
    padding: 4px 0;
}

#changelist #toolbar {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
}

#changelist-search > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

#changelist-search label {
    position: absolute;
    clip-path: inset(50%);
}

#changelist #toolbar form #searchbar, #changelist #toolbar form input[type="submit"] {
    box-sizing: border-box;
    flex: none;
    height: 30px;
    margin: 0;
    border: 1px solid #ccc;
    background-color: transparent;
    color: var(--card-header-fg);
}

#changelist #toolbar form #searchbar {
    flex: 0 1 200px;
    width: 200px;
}

#changelist #toolbar form input[type="submit"] {
    padding: 4px 10px;
    box-shadow: none;
}

#changelist #changelist-search .quiet {
    flex: none;
    width: auto;
    margin: 0;
}

.change-list #content .actions, .change-list #content .paginator {
    border: 0;
    background: none;
}

#changelist .actions label {
    margin-left: 10px;
}

#content .required label::after, #content label.required::after {
    content: " *";
    height: auto;
    vertical-align: baseline;
    color: var(--error-fg);
}

#content .results td, #content .results th {
    border: 1px solid var(--hairline-color);
}

body.popup {
    --gutter: 20px;
}

body.login {
    --gutter: 20px;
    background: #282828;
}

body.login #container {
    border: 0;
    background: rgba(0, 0, 0, .6);
    color: #fff;
}

body.login #header {
    border: 0;
    background: none;
}

body.login #site-name {
    margin: 0;
}

body.login #site-name a {
    color: #fff;
}

body.login #main > .content, body.login #main > .content > #content {
    margin: 0;
    background: none;
}

body.login .form-row {
    border: 0;
}

body.login .form-row label {
    color: #fff;
}

body.login .form-row label::after {
    content: none;
}

body.login .form-row input {
    border: 1px solid #fff;
    border-radius: 0;
    background: transparent;
    color: #fff;
}

body.login .submit-row input {
    width: 200px;
    background: #5262b7;
}

body.login .submit-row input:hover, body.login .submit-row input:focus {
    background: #42509c;
}

@media (max-width: 1024px) {
    :root, html[data-theme] {
        --gutter: 20px;
    }
}

@media (min-width: 768px) {
    #main > .content > #content.colMS {
        width: auto;
    }

    .change-list #content > h1 {
        min-height: 60px;
        box-sizing: border-box;
        padding-right: 60%;
    }

    .change-list #toolbar {
        position: absolute;
        top: 15px;
        left: 42%;
    right: var(--gutter);
        color: var(--card-header-fg);
    }

    .colMS #content-main {
        width: calc(100% - 290px);
    }

    .colMS #content-related {
        margin-right: 0;
    }
}

@media (max-width: 767px) {
    :root, html[data-theme] {
        --gutter: 15px;
    }

    .change-list #toolbar {
        flex-basis: 100%;
    }

    #changelist #toolbar form #searchbar, #changelist #toolbar form input[type="submit"] {
        color: var(--body-fg);
    }

    #changelist-filter details {
        max-width: none;
    }

    #main > .content > #content {
        margin: 0;
        border-radius: 0;
    }

    #main > .content > .messagelist {
        margin: 0;
    }
}
