:root {
  --s100-brand: #369fbe;
  --s100-brand-dark: #217e9a;
}

#header {
  min-height: 76px;
  padding: 6px 24px;
  background: #f7fbfd;
  border-bottom: 1px solid #b8dce7;
  color: var(--s100-brand-dark);
}

#branding {
  flex: 1 1 auto;
}

#user-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: #405866;
}

#user-tools a:link,
#user-tools a:visited,
#logout-form button {
  position: relative;
  z-index: 2;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 9px;
  background: #e8f4f8;
  border: 1px solid #b8dce7;
  border-radius: 5px;
  color: var(--s100-brand-dark);
  cursor: pointer;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

#user-tools a:hover,
#user-tools a:focus,
#logout-form button:hover,
#logout-form button:focus {
  background: #d7edf4;
  border-color: #8bc7dc;
  color: #15566a;
}

#logout-form {
  display: inline-flex;
  margin: 0;
}

#header .theme-toggle {
  position: relative;
  z-index: 2;
  min-width: 34px;
  min-height: 34px;
  margin: 0;
  color: var(--s100-brand-dark);
  cursor: pointer;
}

#header .theme-toggle:hover,
#header .theme-toggle:focus {
  color: #15566a;
}

#header .theme-toggle svg {
  color: currentColor;
}

#site-name {
  margin: 0;
}

#site-name .admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--s100-brand) !important;
  text-decoration: none;
}

.admin-brand-logo {
  width: 64px;
  height: 64px;
  display: block;
  object-fit: cover;
  border: 1px solid #8bc7dc;
  border-radius: 50%;
}

.admin-brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.1;
}

.admin-brand-text strong {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.025em;
}

.admin-brand-text small {
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.login #header {
  height: auto;
  justify-content: center;
}

.login #branding {
  display: flex;
  justify-content: center;
}

.login #container {
  width: min(440px, calc(100% - 32px));
}

.login .form-row #id_username,
.login .form-row #id_password {
  width: 100%;
}

.login .submit-row input {
  background: var(--s100-brand-dark);
}

.login .submit-row input:hover,
.login .submit-row input:focus {
  background: #17677f;
}

@media (max-width: 767px) {
  #header {
    height: auto;
    min-height: 64px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 6px 12px;
  }

  #branding {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .admin-brand-logo {
    width: 52px;
    height: 52px;
  }

  .admin-brand-text strong {
    font-size: 17px;
  }

  .admin-brand-text small {
    font-size: 10px;
  }

  #user-tools {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 0;
    padding: 8px 0 3px;
    border-top: 1px solid #d5e8ee;
    font-size: 11px;
    line-height: 1.35;
    text-align: center;
  }

  .admin-welcome {
    width: 100%;
    text-align: center;
  }

  #user-tools a,
  #logout-form button {
    min-height: 38px;
    padding: 9px 10px;
  }

  #header .theme-toggle {
    min-width: 38px;
    min-height: 38px;
  }
}
