/*
Define custom properties, which can be overridden in base_site.html.

Custom properties need fallbacks for older browsers. If you don't feel like
adding them manually, you can run `npm run build-css` in the `scripts/`
directory in the repo root.

See `scripts/build-css.js` for more information.
*/
:root {
  /* Really supposed to be overridden: */
  --theme-color: #417690;
  --secondary-color: #447e9b;
  --logo-align: middle;

  /* _Could_ be overridden, but are mostly used internally: */
  --darken-25: rgba(0, 0, 0, 0.25);
  --darken-33: rgba(0, 0, 0, 0.33);
  --lighten-25: rgba(255, 255, 255, 0.25);
  --lighten-33: rgba(255, 255, 255, 0.33);
  --lighten-50: rgba(255, 255, 255, 0.5);
  --lighten-75: rgba(255, 255, 255, 0.75);
  --bg-lighten-25: linear-gradient(to bottom, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.25)) /* fallback */;
  --bg-lighten-25: linear-gradient(to bottom, var(--lighten-25), var(--lighten-25));
  --bg-lighten-33: linear-gradient(to bottom, rgba(255, 255, 255, 0.33), rgba(255, 255, 255, 0.33)) /* fallback */;
  --bg-lighten-33: linear-gradient(to bottom, var(--lighten-33), var(--lighten-33));
  --bg-darken-25: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25)) /* fallback */;
  --bg-darken-25: linear-gradient(to bottom, var(--darken-25), var(--darken-25));
  --bg-darken-33: linear-gradient(to bottom, rgba(0, 0, 0, 0.33), rgba(0, 0, 0, 0.33)) /* fallback */;
  --bg-darken-33: linear-gradient(to bottom, var(--darken-33), var(--darken-33));
  --sidebar-width: 250px;
  --searchbar-height: 45px;
  --topbar-height: 70px;
  --topbar-padding: 15px;
  --topbar-height-inner: calc(70px - 15px * 2) /* fallback */;
  --topbar-height-inner: calc(var(--topbar-height) - var(--topbar-padding) * 2);
  --sidebar-transition-duration: 200ms;
  --sidebar-transition: transform 200ms /* fallback */;
  --sidebar-transition: transform var(--sidebar-transition-duration);
}

/***** Layout *****/

body:not(.popup):not(.login) #container {
  width: auto;
  min-width: 0;
  padding-left: 250px /* fallback */;
  padding-left: var(--sidebar-width);
}

/* This is the sidebar. */
body:not(.login) #header {
  box-sizing: border-box;
  position: fixed;
  z-index: 2000;
  top: 0;
  left: 0;
  width: 250px /* fallback */;
  width: var(--sidebar-width);
  height: 100%;
  padding: 0;
}

#header {
  background-color: #417690 /* fallback */;
  background-color: var(--theme-color);
  color: white;
  outline: 0;
}

#branding {
  float: none;
}

#branding a {
  box-sizing: border-box;
  display: block;
  height: 70px /* fallback */;
  height: var(--topbar-height);
  background-color: #417690 /* fallback */;
  background-color: var(--theme-color);
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25)) /* fallback */;
  background-image: var(--bg-darken-25);
  padding: 0 15px;
  font-size: 18px;
  line-height: 70px /* fallback */;
  line-height: var(--topbar-height);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

#branding a:hover,
#branding a:focus,
#branding a:active {
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.33), rgba(0, 0, 0, 0.33)) /* fallback */;
  background-image: var(--bg-darken-33);
  text-decoration: none;
}

body.login #branding a,
body.login #branding a:hover,
body.login #branding a:focus,
body.login #branding a:active {
  background: none;
  padding-left: 5px;
}

#branding a.logo {
  padding-top: 15px;
  line-height: calc(70px - 15px * 2) /* fallback */;
  line-height: var(--topbar-height-inner);
}

#branding a.logo img {
  height: calc(70px - 15px * 2) /* fallback */;
  height: var(--topbar-height-inner);
  vertical-align: middle /* fallback */;
  vertical-align: var(--logo-align);
  margin-right: 10px;
}

#branding a.logo .version {
  font-size: 0.725em;
  color: rgba(255, 255, 255, 0.5) /* fallback */;
  color: var(--lighten-50);
  margin-left: 10px;
}

.nav-global {
  overflow-y: scroll;
  height: 100%;
}

#header nav {
  height: calc(100% - 70px) /* fallback */;
  height: calc(100% - var(--topbar-height));
}

#header nav li {
  padding: 0;
  list-style: none;
}

#header nav > ul {
  margin: 0;
  padding: 0;
  padding-bottom: 15px;
}

#header nav > ul > li {
  margin-top: 15px;
}

#header nav > ul > li > a,
#header nav > ul > li > a:link,
#header nav > ul > li > a:visited,
#header nav > ul > li > a:hover,
#header nav > ul > li > a:focus,
#header nav > ul > li > a:active {
  display: block;
  padding-left: 15px;
  padding-right: 10px;
  color: rgba(255, 255, 255, 0.5) /* fallback */;
  color: var(--lighten-50);
  font-size: 12px;
  text-transform: uppercase;
  text-decoration: none;
}

#header nav > ul > li > ul {
  margin: 0;
  padding: 0;
}

.filtered nav > ul > li > ul {
  display: none;
}

.filtered nav > ul > li:last-child > ul {
  display: block;
}

#header nav > ul > li > ul > li > a {
  display: block;
  padding: 2px 10px;
  padding-left: 30px;
}

#header nav > ul > li > ul > li > a:hover,
#header nav > ul > li > ul > li > a:focus,
#header nav > ul > li > ul > li > a:active,
#header nav > ul > li > ul > li > a.is-selected {
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25)) /* fallback */;
  background-image: var(--bg-darken-25);
  text-decoration: none;
}

/* Add space for the top bar. */
body:not(.login) #messages {
  padding-top: 70px /* fallback */;
  padding-top: var(--topbar-height);
}

/*body.change-list #content {*/
  /*padding-top: 30px;*/
/*}*/

#content,
.dashboard #content,
.admin-view #content,
.popup #content {
  padding: 30px 40px;
}

/* This is the top bar. */
#title {
  box-sizing: border-box;
  position: fixed;
  z-index: 2000;
  top: 0;
  left: 250px /* fallback */;
  left: var(--sidebar-width);
  right: 0;
  height: 70px /* fallback */;
  height: var(--topbar-height);
  margin: 0;
  padding: 15px /* fallback */;
  padding: var(--topbar-padding);
  background-color: #417690 /* fallback */;
  background-color: var(--theme-color);
  color: white;
}

body.popup #title {
  left: 0;
}

body.popup.change-list #content-main {
  padding-top: 0;
}

.hamburger {
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
}

.hamburger:hover,
.hamburger:focus,
.hamburger:active {
  outline: none;
}

.hamburger,
#title .back-arrow {
  display: inline-block;
  float: left;
  min-width: 25px;
  min-height: 1px;
}

body.popup .hamburger,
body.popup #title .back-arrow {
  display: none;
}

.hamburger,
#title a.back-arrow {
  color: rgba(255, 255, 255, 0.5) /* fallback */;
  color: var(--lighten-50);
}

#title a.back-arrow:hover,
#title a.back-arrow:focus,
#title a.back-arrow:active {
  color: white;
}

.hamburger svg,
#title a.back-arrow svg {
  width: calc(70px - 15px * 2) /* fallback */;
  width: var(--topbar-height-inner);
  height: calc(70px - 15px * 2) /* fallback */;
  height: var(--topbar-height-inner);
  margin-right: 12px;
  stroke: currentColor;
}

#title .subject {
  /* Hide for now. */
  display: none;

  /* display: block; */
  color: rgba(255, 255, 255, 0.5) /* fallback */;
  color: var(--lighten-50);
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
}

#title h1 {
  color: white;
  margin: 0;
  line-height: calc(70px - 15px * 2) /* fallback */;
  line-height: var(--topbar-height-inner);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumbs {
  display: none;
}

/* This is the "Add new <model>" button etc. */
#header .object-tools {
  position: static;
  overflow: visible;
  margin: 0;
  padding: 0 0 0 15px;
}

#header .object-tools {
  float: none;
  overflow: hidden;
  padding-bottom: 15px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.25) /* fallback */;
  border-bottom: 1px dashed var(--lighten-25);
}

#header .object-tools.view-tools {
  padding-bottom: 0;
  border-bottom: 0;
}

#header .object-tools li {
  clear: left;
  height: auto;
  margin-left: 0;
  overflow: visible;
}

#header .object-tools a {
  float: none;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 0;
  font-size: inherit;
  letter-spacing: 0;
  text-transform: none;
  background-color: transparent;
}

#content .object-tools {
  position: fixed;
  z-index: 3000;
  top: calc(70px / 2) /* fallback */;
  top: calc(var(--topbar-height) / 2);
  right: 20px;
  transform: translateY(-50%);
  margin: 0;
}

#content .object-tools li {
  height: auto;
  margin-left: 10px;
}

#content .object-tools a:link,
#content .object-tools a:visited {
  background-color: rgba(0, 0, 0, 0.25) /* fallback */;
  background-color: var(--darken-25);
}

#content .object-tools li {
  float: right;
}

#content .object-tools a:hover,
#content .object-tools a:focus,
#content .object-tools a:active {
  background-color: rgba(0, 0, 0, 0.33) /* fallback */;
  background-color: var(--darken-33);
  filter: none;
}

.change-list .results,
.change-list .paginator {
  width: auto;
}

#changelist .paginator {
  border: none;
}

.paginator .this-page {
  border-radius: 100px;
  border: 1px solid #417690 /* fallback */;
  border: 1px solid var(--theme-color);
  background: #417690 /* fallback */;
  background: var(--theme-color);
  padding: 2px 8px;
  color: #fff;
}

.paginator a:link,
.paginator a:visited {
  box-sizing: border-box;
  border: 1px solid #fff;
  border-radius: 100px;
  padding: 2px 8px;
  background: none;
  color: #447e9b /* fallback */;
  color: var(--secondary-color);
}

.paginator a:focus,
.paginator a:hover {
  background: #ccc;
  border-color: #417690 /* fallback */;
  border-color: var(--theme-color);
}

.paginator a.showall {
  background: none;
  color: #447e9b /* fallback */;
  color: var(--secondary-color);
}

.paginator a.showall:focus,
.paginator a.showall:hover {
  color: #447e9b /* fallback */;
  color: var(--secondary-color);
  filter: brightness(120%) saturate(75%);
}

fieldset .form-row:last-child {
  border-bottom: 0;
}

#content-related .module h2 {
  padding: 16px 0 10px 0;
  background-color: white;
}

/***** Adjust colors. *****/

a:link, a:visited,
#changelist-filter li.selected a {
  color: #447e9b /* fallback */;
  color: var(--secondary-color);
}

#content-main a:focus,
#content-main a:hover {
  filter: brightness(120%) saturate(75%);
}

.button:hover,
.button:focus,
.button:active,
a.button:hover,
a.button:focus,
a.button:active,
input[type="submit"]:hover,
input[type="submit"]:focus,
input[type="submit"]:active,
input[type="button"]:hover,
input[type="button"]:focus,
input[type="button"]:active,
.submit-row input:hover,
.submit-row input:focus,
.submit-row input:active,
.calendar td a:active,
.timelist a:active {
  background-color: #417690 /* fallback */;
  background-color: var(--theme-color);
  background-image: none;
}

.module h2,
.module caption,
.inline-group h2,
.selector-chosen h2,
.button,
.button:disabled,
a.button,
a.button:disabled,
input[type="submit"],
input[type="submit"]:disabled,
input[type="button"],
input[type="button"]:disabled,
.submit-row input,
.submit-row input:disabled,
.calendar td a:hover,
.calendar td a:focus,
.timelist a:hover,
.timelist a:focus,
.calendar td.selected a {
  background-color: #417690 /* fallback */;
  background-color: var(--theme-color);
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.25)) /* fallback */;
  background-image: var(--bg-lighten-25);
}

.button.default:hover,
.button.default:focus,
.button.default:active,
input[type="submit"].default:hover,
input[type="submit"].default:focus,
input[type="submit"].default:active,
.submit-row input.default:hover,
.submit-row input.default:focus,
.submit-row input.default:active {
  background: #417690 /* fallback */;
  background: var(--theme-color);
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25)) /* fallback */;
  background-image: var(--bg-darken-25);
}

.button.default,
.button.default:disabled,
input[type="submit"].default,
input[type="submit"].default:disabled,
.submit-row input.default,
.submit-row input.default:disabled {
  background: #417690 /* fallback */;
  background: var(--theme-color);
}

.button:disabled,
a.button:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
}

.module > h2,
.module > caption,
.module > table > caption {
  background-color: none;
  background: none;
  color: #333;
  font-size: 22px;
}

.module > h2 a.section:link,
.module > caption a.section:link,
.module > h2 a.section:visited,
.module > caption a.section:visited,
.module > table > caption a.section {
  color: #333;
  font-size: 22px;
}

tbody th {
  font-weight: normal;
}

.dashboard #content {
  width: auto;
}

a.selector-chooseall, a.selector-clearall {
  font-weight: normal;
}

a.active.selector-chooseall:focus,
a.active.selector-clearall:focus,
a.active.selector-chooseall:hover,
a.active.selector-clearall:hover {
  color: #447e9b /* fallback */;
  color: var(--secondary-color);
  /* TODO: selector-icons.svg is hardcoded blue on hover */
}

@supports (background-blend-mode: overlay) {
  .datetimeshortcuts .date-icon,
  .datetimeshortcuts .clock-icon {
    background: none;
    background-color: #447e9b /* fallback */;
    background-color: var(--secondary-color);
    background-blend-mode: overlay;
  }

  .datetimeshortcuts .date-icon {
    -webkit-mask-image: url(../../img/icon-calendar.svg);
    mask-image: url(../../img/icon-calendar.svg);
  }

  .datetimeshortcuts .clock-icon {
    -webkit-mask-image: url(../../img/icon-clock.svg);
    mask-image: url(../../img/icon-clock.svg);
  }
}

.calendar caption,
.calendarbox h2 {
  color: white;
}

.calendarbox .calendarnav-previous,
.calendarbox .calendarnav-next {
  filter: invert(1);
}

.calendarbox .calendarnav-previous {
  background-position: 0 -15px;
}

.calendarbox .calendarnav-next {
  background-position: 0 -45px;
}

#header #changelist-filter {
  width: auto;
  position: static;
  display: block;
  margin-top: 15px;
  background: transparent;
  clear: both;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.25) /* fallback */;
  border-bottom: 1px dashed var(--lighten-25);
}

#header #changelist-filter h2,
#header #changelist-filter h3,
#header #object-tools h2 {
  display: block;
  padding-left: 15px;
  padding-right: 10px;
  color: rgba(255, 255, 255, 0.5) /* fallback */;
  color: var(--lighten-50);
  font-size: 12px;
  text-transform: uppercase;
  text-decoration: none;
  font-weight: normal;
  margin: 15px 0 0 0;
  line-height: 20px;
  padding: 0 0 0 15px;
}

#header #changelist-filter h2 {
  margin: 0 0.3em 0 0;
  float: left;
}

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

#header #object-tools h2 {
  margin: 15px 0 0 0;
}

#header #changelist-filter ul {
  margin-bottom: 15px;
  padding: 0 15px 0;
  border-bottom: 0;
}
#header #changelist-filter li.selected {
  border-left-color: rgba(0, 0, 0, 0.25) /* fallback */;
  border-left-color: var(--darken-25);
}

#header #changelist-filter li a {
  color: rgba(255, 255, 255, 0.75) /* fallback */;
  color: var(--lighten-75);
}

#header #changelist-filter li.selected a {
  color: #fff;
}

body.popup #changelist #toolbar {
  margin-bottom: 0;
}
body:not(.popup) #changelist #toolbar {
  display: none;
}

.change-list .filtered .results,
.change-list .filtered .paginator,
.filtered #toolbar,
.filtered div.xfull,
#changelist .actions {
  margin-right: 0;
}

.change-list #content {
  padding: 0;
}

.change-list #content-main {
  padding-top: 45px /* fallback */;
  padding-top: var(--searchbar-height);
}

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

#changelist .toplinks {
  background-color: #f6f6f6;
  border-bottom: 0;
}

#changelist .actions {
  position: absolute;
  top: calc(-1 * 45px) /* fallback */;
  top: calc(-1 * var(--searchbar-height));
  left: 0;
  right: 0;
  background: #417690 /* fallback */;
  background: var(--theme-color);
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.33), rgba(255, 255, 255, 0.33)) /* fallback */;
  background-image: var(--bg-lighten-33);
  color: #fff;
  line-height: 25px;
  height: 25px;
}

#changelist .results ~ .actions {
  position: static;
  background-color: transparent;
  color: #333;
}

#changelist .results ~ .actions select {
  border-color: #ccc;
}

#changelist .actions label {
  vertical-align: top;
}

#changelist .actions select {
  min-width: 300px;
  height: 25px;
  background: #fff;
  border-color: #fff;
}

#changelist .actions .button {
  min-width: 48px;
  height: 25px;
  margin: 0 0 0 10px;
  vertical-align: top;
  background: #417690 /* fallback */;
  background: var(--theme-color);
  box-shadow: none;
  border: 0;
  color: #fff;
}

#changelist .actions span.all,
#changelist .actions span.action-counter,
#changelist .actions span.clear,
#changelist .actions span.question {
  margin: 0 0 0 10px;
}
