:root {
    --spacing: 5px;

    --color-text-primary: #333;
    --color-button-text-disabled: #999;

    /* Defaults / General */
    --default-gap: 8px;
    --color-clear-bg: rgba(0, 0, 0, 0.0);
    --color-obscure-bg: rgba(0, 0, 0, 0.5);
    --color-error-text: #ff0000;

    /* Header */
    --color-header-text-primary: #F7F7F7;
    --color-header-text-secondary: #BBC9DA;
    --color-header-text-non-standard-host-name: #ffbf00;
    --color-header-bg: #2C5C97;
    --color-header-border: #999;

    /* Button */
    --color-button-bg-active: #dde1e5;
    --color-button-bg-hover: #cdcfd2;
    --color-id-number-text: #800080;
    --color-button-border: #999;

    
    /* Sidebar */
    --indent-sidebar-context: 10px;
    --width-sidebar-context: 190px;
    --width-sidebar-nav: 50px;

    /* Nav */
    --color-nav-bg: #E5E5E5;

    /* Nav Button */
    --color-nav-button-bg: #CECECE;
    --color-nav-button-text: #404040;
    --color-nav-button-text-active: #f2f2f2;
    /* --color-nav-button-bg-hover: #B6B6B6; */
    --color-nav-button-bg-active: #2C5C97;

    /* Context */
    --color-context-bg: #ffffff;
    --color-context-border: #ccc;

    /* Breadcrumb Bar */
    --color-breadcrumb-bar-bg: #ccc;
    --color-breadcrumb-bar-border: #ccc;
    --color-breadcrumb-bar-text: #666;

    /* Workspace */
    --color-workspace-bg: #F3F4F6;

    /* Table */
    --color-table-border: #999999;
    --color-table-data-bg: #fffee9;
    /* --color-table-data-odd-bg: #f0f5ff; */
    --color-table-data-odd-bg: #deeafe;
    --color-table-header-bg: #9fc3ff;
    --color-table-row-hover-bg: #ffff00;
    --color-table-text-placeholder: #999;

    /* Mobile Scroll */
    --color-mobile-scroll-bg: #dae8fa;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "IBM Plex Sans", sans-serif;
    color: var(--color-text-primary);
}

button, input[type=submit]{
    display: inline-block;
    margin: 0;
    min-height: 24px;
    font-size: 15px;
    color: var(--color-text-primary);
    background: var(--color-button-bg-active);
    border-radius: 5px;
    padding: 4px 10px;
    border: 0;
    cursor: pointer;
    text-align: center;
    /* display: flex;
    justify-content: center;
    align-content: center;
    flex-direction: column; */

    /* No text selection inside the button */
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+/Edge */
    user-select: none; /* Standard */
}
button:disabled{
    color: var(--color-button-text-disabled);
    cursor: auto;
}
button:hover:enabled, input[type=submit]:hover:enabled{
    background: var(--color-button-bg-hover);
}
input {
    height: 24px;
    font-size: 16px;
    border-radius: 5px;
    border: 0;
    margin: 0;
    padding: 0px 6px;
}
input[type="radio"] {
    margin-top: -1px;
    vertical-align: middle;
}

.root {
    display: flex;
    flex-flow: column;

    background-color: yellowgreen;
    height: 100%;
    min-height: 0;
    width: 100%;
}

.root__header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    color: var(--color-header-text-primary);
    padding: 0px 6px 0px 4px;
    background-color: var(--color-header-bg);
    border-bottom: var(--color-header-border) 1px solid;
    font-size: 16px;
}

.header__group {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 8px;
}

.header__title{
    font-size: 16px;
}
.header__version{
    display: flex;
    align-content: center;
    flex-direction: column;
    justify-content: center;
}
.header__non-standard-host-name{
    display: flex;
    flex-direction: column;
    align-content: center;
    justify-content: center;
    
    color: var(--color-header-text-non-standard-host-name);

    margin-left: 0;
}
.header__toggle-sidebar{
    display: none;
    align-items: center;
    justify-content: center;
    margin-right: 8px;

    width: 30px;
    height: 30px;
    border-radius: 50%;

    color: #f2f2f2;
    background-color: #324772;
}
.header__username {
    display: flex;
    align-items: center;
}
.header__button-container{
    display: flex;

    justify-content: center;
    align-content: center;
    flex-direction: column;
}

.root__stage{
    display: flex;
    flex-flow: row;
    flex: 1 1;
    justify-content: space-between;
    height: 100%;
    min-height: 0;
}

.error-text{
    color: var(--color-error-text);
}
/* ----------------------------
 * Sidebar
 * ---------------------------- */
.stage__sidebar{
    display: flex;
    flex-flow: row;
    flex: 1 1;
    justify-content: space-between;
    min-width: calc(var(--width-sidebar-nav) + var(--width-sidebar-context));
    max-width: calc(var(--width-sidebar-nav) + var(--width-sidebar-context));
    height: 100%;
    /* background-color: #e27bfe; */
    z-index: 20;
}

/* ----------------------------
 * Nav
 * ---------------------------- */
.nav__body{
    display: flex;
    align-items: center;
    flex-flow: column;
    flex: 1 1 auto;
    justify-content: flex-start;

    min-width: var(--width-sidebar-nav);
    max-width: var(--width-sidebar-nav);
    height: 100%;
    width: 100%;
    background-color: var(--color-nav-bg);
    /* background-color: #f1d3fa; */
}

.nav__button {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;
    border-radius: 50%;

    color: var(--color-nav-button-text);
    background-color: var(--color-nav-button-bg);
    text-decoration: none;
}
.nav__button:hover:not(.nav__button--active) {
    filter: brightness(80%)
}

.nav__button--active {
    color: var(--color-nav-button-text-active);
    background-color: var(--color-nav-button-bg-active);
}

/* ----------------------------
 * Sidebar
 * ---------------------------- */
 .sidebar__context {
    display: flex;
    flex-flow: column;
    flex: 1 1 auto;
    justify-content: space-between;
    align-items: stretch;
    gap: 10px;

    min-width: var(--width-sidebar-context);
    max-width: var(--width-sidebar-context);

    /* background-color: #f3a20b; */
    background-color: var(--color-context-bg);
    border-right: 1px solid var(--color-context-border);
}
.context__body {
    display: flex;
    flex-flow: column;
    align-items: stretch;
    margin: 10px; 
    gap: 10px;
    background-color: var(--color-context-bg);
}
.context__body h1 {
    font-size: 14px;
    margin: 0;
    border-bottom: 1px solid #5b76a6;
    color: #3A4E6E;
}

/* ----------------------------
 * Mainstage
 * ---------------------------- */
 .stage__mainstage {
    flex: 1 1;
    display: flex;
    flex-flow: column;
    align-items: stretch;
    justify-content: space-between;
    justify-content: flex-start;
    height: 100%;
    /* TODO: Width: subtract side panel? */
    /* TODO: The reason that 80% works here is a mystery. 70 works too, but at 100 we overflow. Why?
       there must be a better way to solve this */
    width: 80%;
    min-height: 0;
    
    background-color: var(--color-workspace-bg);
}

/* ----------------------------
 * Breadcrumb bar
 * ---------------------------- */
 .mainstage__breadcrumb-bar {
    background-color: var(--color-breadcrumb-bar-bg);
    border-bottom: 1px solid var(--color-breadcrumb-bar-border);

    /* No text selection */
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+/Edge */
    user-select: none; /* Standard */

    font-size: 16px;
}

.breadcrumb-bar__body {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    height: 10px;
    margin: 0.5rem;
    margin-left: var(--default-gap);
    
    color: var(--color-breadcrumb-bar-text);
    white-space: nowrap;
}
.breadcrumb-bar__body a {
    text-decoration: none;
    color: var(--color-breadcrumb-bar-text);
}

.breadcrumb-fa-icon {
    margin-right: 4px;
}
.breadcrumb-fa-chevron {
    margin-right: 4px;
    margin-left: 4px;
}

/* ----------------------------
 * Workspace
 * ---------------------------- */
.mainstage__workspace {
    flex: 1 1;
    display: flex;
    flex-flow: column;
    align-items: stretch;
    justify-content: space-between;
    justify-content: flex-start;
    height: 100%;
    width: 100%;
    min-height: 0;
    
    background-color: var(--color-workspace-bg);
}

.workspace__body {
    flex: 1 1;
    display: flex;
    flex-flow: column;
    align-items: stretch;
    justify-content: flex-start;
    height: 100%;
    min-height: 0;
    margin: 10px;
    
    background-color: var(--color-workspace-bg);
}

.workspace__heading-row{
    display: flex;
    flex-direction: row;
}
.workspace__heading-icon{
    display: flex;
    flex-direction: row;
    /* margin-bottom: 10px; */
}
.workspace__title{
    font-size: 20px;
    font-weight: 700;
}
.workspace__row{
    display: flex;
    flex-direction: row;
}

.workspace__body h2 {
    font-size: 19px;
    margin: 0;
}

/* ----------------------------
 * Link as Button
 * ---------------------------- */
.link-as-button {
    display: inline-block;
    text-decoration: none;
    text-align: center;
    margin-left: 8px;
    font-size: 15px;
    color: var(--color-text-primary);
    border: 0;
    background: var(--color-button-bg-active);
    border-radius: 5px;
    padding: 4px 10px;
    cursor: pointer;
    /* white-space: nowrap; */

    /* No text selection inside the button/link */
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+/Edge */
    user-select: none; /* Standard */
}
.link-as-button:hover {
    background: var(--color-button-bg-hover);
}
.button--id-number {
    color: var(--color-id-number-text);
    font-weight: 700;
}
.button--border{
    border: 1px solid var(--color-button-border);
}

/* ----------------------------
 * ID Numbers
 * ---------------------------- */
 .span--id-number {
    color: var(--color-id-number-text);
    font-weight: 700;
    margin: 0 5px;
 }

/* ----------------------------
 * Dimmer
 * ---------------------------- */
 .dimmer{
    /* This div fills the whole screen and acts as a "dimmer" for
    * the base content of the page. The mp-card-detail element inherits
    * its visibility from this root, so we show/hide the card detail by
    * toggling the visibility of this element.
    */
    z-index: 10;
    position: absolute;
    pointer-events: none;

    width: 100%;
    left: 0px;
    
    height: 100%;
    top: 0px;

    background-color: var(--color-clear-bg);
    -webkit-transition: background-color 400ms linear;
    -ms-transition: background-color 400ms linear;
    transition: background-color 400ms linear;
}
.dimmer--obscure{
    pointer-events: auto;
    background-color: var(--color-obscure-bg);
}

/* ----------------------------
 * ISO-8601 Date
 * ---------------------------- */
/* The display:inline makes it so that the span does not cause a line break during copy-paste */
.span__iso8601-t, .span__iso8601-offset{
    opacity: 0.5; 
    display: inline;
}

/* ----------------------------
 * Generic Table
 * ----------------------------
 */
table.generic-table{
    border-spacing: 0px;
    border-collapse: collapse;
    margin: 1rem;
    border: 1px solid var(--color-table-border);
}
.generic-table td, 
.generic-table th {
    border: 1px solid var(--color-table-border);
    padding: 2px 10px;
}
.generic-table th {
    background: var(--color-table-header-bg);
}
.generic-table td {
    background: var(--color-table-data-bg);
}
.table--zebra td,
.table--zebra th {
    border: none;
}
.table--zebra tr:nth-child(odd) td {
    background: var(--color-table-data-odd-bg);
}
.table--zebra tr:hover td {
    background: var(--color-table-row-hover-bg);
}
.table__text-placeholder {
    color: var(--color-table-text-placeholder);
    font-style: italic;
}

/* ----------------------------
 * Scrolling containers for mobile tables
 * ----------------------------
 */
.container-mobile-scroll{
    flex: 0 0 auto;
    display: inline-block;
    background-color: var(--color-clear-bg);
    min-height: 100px;
    min-width: 360px;
}
.container-mobile-scroll table {
    margin: 0;
}

@media screen and (max-width: 768px) {
    .container-mobile-scroll{
        height: 400px;
        width: 360px;
        overflow: scroll;
        background-color: var(--color-mobile-scroll-bg);
    }
    .container-mobile-scroll table {
        margin: 5px;
    }
}

 /* ----------------------------------
 * Tooltips (JQuery UI)
 * ----------------------------------
 */
 .ui-tooltip{
    background: rgb(255, 255, 148) !important;
    /* Allow /n to force line breaks */
    white-space: pre-line;
}

/* ----------------------------
 * Media
 * ---------------------------- */

 @media screen and (max-width: 768px) {
    .header__toggle-sidebar{
        display: flex;
    }
    .header__username{
        display: none;
    }
    .header__non-standard-host-name{
        display: none;
    }
    .stage__sidebar{
        position: absolute;
        transform: translateX(-100%);
        -webkit-transform: translateX(-100%);
        /* Must force height because auto-height no longer works when this
         * menu is hidden.  The value below leaves a big gap but has enough
         * margin so scroll bars won't start appearing if the heading bar
         * ever changes height slightly.
         */
        height: 90dvh;
    }
    .sidebar--slide-in {
        animation: animation-slide-in 0.5s forwards;
        -webkit-animation: animation-slide-in 0.5s forwards;
    }
    
    .sidebar--slide-out-immediate {
        animation: animation-slide-out 0s forwards;
        -webkit-animation: animation-slide-out 0s forwards;
    }

    .sidebar--slide-out {
        animation: animation-slide-out 0.5s forwards;
        -webkit-animation: animation-slide-out 0.5s forwards;
    }
    
    /* The dropzone js library is already using the animation
     * names `slide-in` and `slide-out`, so we prefix with `animation-`
     * to avoid the name collision.
     */
    @keyframes animation-slide-in {
        100% { transform: translateX(0%); }
    }
    
    @-webkit-keyframes animation-slide-in {
        100% { -webkit-transform: translateX(0%); }
    }
        
    @keyframes animation-slide-out {
        0% { transform: translateX(0%); }
        100% { transform: translateX(-100%); }
    }
    
    @-webkit-keyframes animation-slide-out {
        0% { -webkit-transform: translateX(0%); }
        100% { -webkit-transform: translateX(-100%); }
    }
}